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 'COMPLETE_PLAYING':
// Video finished playing
break;
case 'SKIPPED':
// User closed without completing — no reward
break;
case 'FAILED':
// Ad failed to load — disable "Watch Ad" button
break;
case 'USED':
// Ad was closed — reload for next time
EmpowerAds.loadRewardedAd(zoneId);
break;
}
});
// Clean up
subscription.cancel();

Important: Only grant rewards when the status is REWARDED. The SKIPPED status means the user closed the ad without completing it — do not grant a reward in this case.


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 {
@override
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';
@override
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;
}
});
}
@override
void dispose() {
_rewardedSub?.cancel();
super.dispose();
}
@override
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
↓ ↓
FAILED User skips → SKIPPED → USED

Best Practices

  • Wait for SDK readiness — Load rewarded ads after the SDK has fully initialized. Listening for an onBannerStatusChanged event is a reliable signal that ad zones are parsed and ready.
  • 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
SKIPPEDUser closed without completing
USEDAd was shown and closed