Interstitial Ads

Interstitial ads are full-screen ads that cover the interface. Display them at natural pause points in your app, such as between game levels or after completing a task.

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 interstitial
EmpowerAds.loadInterstitialAd(zoneId);
// Step 2: Listen for status (optional)
final subscription = EmpowerAds.onInterstitialStatusChanged.listen((event) {
final status = event['status'];
if (status == 'READY') {
print('Interstitial ready to show');
}
});
// Step 3: Show at a natural break point
void onLevelComplete() {
EmpowerAds.showInterstitial(zoneId);
}

Loading Interstitials

Load interstitial ads in advance so they're ready when needed:

import 'package:empower_mobile_ads/empower_mobile_ads.dart';
// Load with zone ID
await EmpowerAds.loadInterstitialAd('YOUR_ZONE_ID');

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


Showing Interstitials

import 'package:empower_mobile_ads/empower_mobile_ads.dart';
Future<void> showInterstitialIfReady() async {
final shown = await EmpowerAds.showInterstitial('YOUR_ZONE_ID');
if (!shown) {
print('Interstitial not ready yet');
}
}

Listening to Interstitial Status (Optional)

import 'dart:async';
import 'package:empower_mobile_ads/empower_mobile_ads.dart';
final zoneId = 'YOUR_ZONE_ID';
final subscription = EmpowerAds.onInterstitialStatusChanged.listen((event) {
final status = event['status'];
switch (status) {
case 'READY':
// Ad is ready to be shown
break;
case 'FAILED':
// Ad failed to load — retry later
break;
case 'SHOWN':
// Ad is being displayed
break;
case 'SKIPPED':
// User dismissed the ad
break;
case 'USED':
// Ad was shown and closed — preload next
EmpowerAds.loadInterstitialAd(zoneId);
break;
}
});
// Clean up when no longer needed
subscription.cancel();

Complete Example

import 'dart:async';
import 'dart:io';
import 'package:flutter/material.dart';
import 'package:empower_mobile_ads/empower_mobile_ads.dart';
class GameScreen extends StatefulWidget {
@override
State<GameScreen> createState() => _GameScreenState();
}
class _GameScreenState extends State<GameScreen> {
int _level = 1;
bool _adReady = false;
StreamSubscription? _interstitialSub;
StreamSubscription? _bannerSub;
final String _zoneId = Platform.isAndroid ? 'ANDROID_ZONE_ID' : 'IOS_ZONE_ID';
@override
void initState() {
super.initState();
// Listen for interstitial status changes
_interstitialSub = EmpowerAds.onInterstitialStatusChanged.listen((event) {
final status = event['status'];
if (status == 'READY') {
setState(() => _adReady = true);
} else if (status == 'USED' || status == 'FAILED') {
setState(() => _adReady = false);
// Reload for next time
EmpowerAds.loadInterstitialAd(_zoneId);
}
});
// Wait for SDK to be ready before loading interstitial.
// Banner status event is a reliable signal that the SDK has
// finished parsing ad zones.
_bannerSub = EmpowerAds.onBannerStatusChanged.listen((_) {
EmpowerAds.loadInterstitialAd(_zoneId);
_bannerSub?.cancel();
});
}
@override
void dispose() {
_interstitialSub?.cancel();
_bannerSub?.cancel();
super.dispose();
}
void _completeLevel() {
setState(() => _level++);
// Show interstitial every 3 levels
if (_level % 3 == 0 && _adReady) {
EmpowerAds.showInterstitial(_zoneId);
}
}
@override
Widget build(BuildContext context) {
return Scaffold(
body: Center(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Text('Level $_level', style: const TextStyle(fontSize: 24)),
const SizedBox(height: 20),
ElevatedButton(
onPressed: _completeLevel,
child: const Text('Complete Level'),
),
],
),
),
);
}
}

Best Practices

  • Wait for SDK readiness — Load interstitial ads after the SDK has fully initialized. Listening for an onBannerStatusChanged event is a reliable signal that ad zones are parsed and ready.
  • Preload ads — Load ads before you need them for instant display
  • Natural break points — Show ads at logical pauses (level complete, article end, screen transitions)
  • Don't interrupt — Avoid showing during active gameplay or content consumption
  • Reload after use — Load a new ad after each display using the USED status callback
  • Frequency capping — The SDK respects server-configured frequency caps

Ad Status Reference

StatusDescription
INITIALIZINGAd is loading
READYAd is loaded and ready to display
FAILEDAd failed to load
SHOWNAd is being displayed
SKIPPEDUser dismissed the ad
USEDAd was shown and closed
WILL_LEAVEUser clicked the ad (leaving app)