Skip to main content

Rewarded Ads

Rewarded ads let users opt-in to watch a video ad in exchange for an in-app reward (extra lives, premium content, virtual currency, etc.).

Each ad format uses a Zone ID to identify the ad placement. Zone IDs are configured in the Empower dashboard.

Note: All ad status listeners are optional. The SDK handles ad loading and display automatically. Use listeners only if you need to track ad states for analytics, UI updates, or custom logic.


Quick Start​

import 'dart:async';
import 'dart:io';
import 'package:empower_mobile_ads/empower_mobile_ads.dart';

final zoneId = Platform.isAndroid ? 'ANDROID_ZONE_ID' : 'IOS_ZONE_ID';

// Step 1: Preload the rewarded ad
EmpowerAds.loadRewardedAd(zoneId);

// Step 2: Listen for reward
final subscription = EmpowerAds.onRewardedStatusChanged.listen((event) {
final status = event['status'];
if (status == 'rewarded') {
// User earned the reward — grant it here
grantReward();
}
});

// Step 3: Show when user taps "Watch Ad" button
void onWatchAdPressed() {
EmpowerAds.showRewarded(zoneId);
}

Loading Rewarded Ads​

import 'package:empower_mobile_ads/empower_mobile_ads.dart';

// Load with zone ID
await EmpowerAds.loadRewardedAd('YOUR_ZONE_ID');

The method returns a Future<bool> that resolves to true when the ad starts loading.


Showing Rewarded Ads​

import 'package:empower_mobile_ads/empower_mobile_ads.dart';

Future<void> showRewardedAd() async {
final shown = await EmpowerAds.showRewarded('YOUR_ZONE_ID');
if (!shown) {
print('Rewarded ad not ready yet');
}
}

Listening to Rewarded Status (Optional)​

import 'dart:async';
import 'package:empower_mobile_ads/empower_mobile_ads.dart';

final zoneId = 'YOUR_ZONE_ID';

final subscription = EmpowerAds.onRewardedStatusChanged.listen((event) {
final status = event['status'];

switch (status) {
case 'ready':
// Ad is ready to be shown — enable "Watch Ad" button
break;
case 'rewarded':
// User earned the reward — grant it here
grantReward();
break;
case 'completePlaying':
// Video finished playing
break;
case 'skipped':
// The ad closed. Reload for next time
EmpowerAds.loadRewardedAd(zoneId);
break;
case 'failed':
// Ad failed to load — disable "Watch Ad" button
break;
case 'used':
// Ad closed after the reward was earned — reload for next time
EmpowerAds.loadRewardedAd(zoneId);
break;
}
});

// Clean up
subscription.cancel();

Important: Only grant rewards when the status is rewarded. The skipped and used statuses only report that the ad closed, so never grant a reward on either. On Android an ad that gave the reward also closes with skipped.


Complete Example​

import 'dart:async';
import 'dart:io';
import 'package:flutter/material.dart';
import 'package:empower_mobile_ads/empower_mobile_ads.dart';

class StoreScreen extends StatefulWidget {

State<StoreScreen> createState() => _StoreScreenState();
}

class _StoreScreenState extends State<StoreScreen> {
int _coins = 0;
bool _adReady = false;
StreamSubscription? _rewardedSub;

final String _zoneId = Platform.isAndroid ? 'ANDROID_ZONE_ID' : 'IOS_ZONE_ID';


void initState() {
super.initState();

// Preload rewarded ad
EmpowerAds.loadRewardedAd(_zoneId);

_rewardedSub = EmpowerAds.onRewardedStatusChanged.listen((event) {
final status = event['status'];

switch (status) {
case 'ready':
setState(() => _adReady = true);
break;
case 'rewarded':
setState(() => _coins += 100);
ScaffoldMessenger.of(context).showSnackBar(
const SnackBar(content: Text('You received 100 coins!')),
);
break;
case 'failed':
setState(() => _adReady = false);
break;
case 'used':
case 'skipped':
setState(() => _adReady = false);
EmpowerAds.loadRewardedAd(_zoneId); // Reload for next time
break;
}
});
}


void dispose() {
_rewardedSub?.cancel();
super.dispose();
}


Widget build(BuildContext context) {
return Scaffold(
body: Center(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Text(
'Coins: $_coins',
style: const TextStyle(fontSize: 32, fontWeight: FontWeight.bold),
),
const SizedBox(height: 20),
ElevatedButton(
onPressed: _adReady ? () => EmpowerAds.showRewarded(_zoneId) : null,
child: Text(_adReady ? 'Watch Ad for 100 Coins' : 'Loading...'),
),
],
),
),
);
}
}

Status Flow​

loadRewardedAd() → INITIALIZING → READY → showRewarded() → SHOWN → User watches → REWARDED → USED (iOS) or SKIPPED (Android)
↓ ↓
FAILED User closes early → SKIPPED

Best Practices​

  • Wait for SDK readiness — Load rewarded ads after the SDK signals it is ready via the onSdkReady stream.
  • Clear value exchange — Clearly communicate what reward users will receive before showing the ad
  • User-initiated — Only show when users actively choose to watch (e.g., tapping a "Watch Ad" button)
  • Grant rewards on REWARDED only — Only grant rewards on REWARDED status, not SKIPPED or USED
  • Reload after use — Load a new ad after each display
  • Disable button while loading — Use the READY / FAILED status to toggle the "Watch Ad" button

Ad Status Reference​

StatusDescription
INITIALIZINGAd is loading
READYAd is loaded and ready to display
FAILEDAd failed to load
SHOWNAd is being displayed
COMPLETE_PLAYINGVideo finished playing
REWARDEDUser earned the reward
SKIPPEDThe ad was closed. On iOS only before the reward, on Android also after it
USEDThe ad was closed after the reward

Note: A rewarded ad ends with either used or skipped. On iOS used follows rewarded and skipped means the ad closed early. On Android the ad always ends with skipped. Reload on both.