This repository was archived by the owner on Mar 12, 2022. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 58
Ad error codes
Bruno D'Luka edited this page Feb 14, 2021
·
5 revisions
Errors can be handled by any ads by listening to their events
ad.onEvent.listen((e) {
final event = e.keys.first;
switch (event) {
case InterstitialAdEvent.loadFailed:
final error = e.values.first;
print('load failed: ${error.code}');
break;
case InterstitialAdEvent.showFailed:
final error = e.values.first;
print('show failed: ${error.code}');
break;
default:
break;
}
});
Instead of InterstitialAdEvent
, you can use:
-
RewardedAdEvent
for Rewarded Ads -
AppOpenEvent
for App Open Ads
You must attach a controller to the ad widget.
final controller = NativeAdController(); /* or BannerAdController(), if you're using banner ad */
Widget build(BuildContext context) {
return NativeAd(controller: controller); /* or BannerAd() */
}
ad.onEvent.listen((e) {
final event = e.keys.first;
switch (event) {
case NativeAdEvent.loadFailed: /* or BannerAdEvent */
final error = e.values.first;
print('load failed: ${error.code}');
break;
default:
break;
}
});
- Internal error
Something happened internally; for instance, an invalid response was received from the ad server
- Invalid request
The ad request was invalid; for instance, the ad unit ID was incorrect
- Network error
The ad request was unsuccessful due to network connectivity
- No fill
The ad request was successful, but no ad was returned due to lack of ad inventory
- Reused ad
You're reusing an ad. This will rarely happen because this error is handled by the plugin
- Ad not ready
The ad is not ready to be shown
- App not in foreground
The app must be in foreground so the ad can be shown
You can see the list for iOS error codes here