This repository has been 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 Apr 20, 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 and Rewarded Interstitial 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;
}
});
Code | Name | Description |
---|---|---|
-1 | Timeout reached | The load timeout was achieved |
0 | Internal error | Something happened internally, usually, an invalid response is received from the server |
1 | Invalid request | The request was invalid, usually, the ad unit ID was incorrect |
2 | Network error | The request was unsuccessful due to network connectivity |
3 | No fill | The request was successful, but no ad was returned due to lack of ad inventory |
These errors usually come from Rewarded, Interstitial and App Open ads when trying to show.
Code | Name | Description |
---|---|---|
0 | Internal Error | Indicates something unexpected happened internally. |
1 | Ad reused | Indicates the ad has already been shown. |
2 | Ad not ready | Indicates the ad is not ready to be shown |
3 | App not in foreground | The app must be in foreground so it can be shown |
List of errors for:
NOTE: Error codes may differ on different platforms