Skip to content
This repository was archived by the owner on Mar 12, 2022. It is now read-only.

Ad error codes

Bruno D'Luka edited this page Feb 14, 2021 · 5 revisions

Handling errors

Errors can be handled by any ads by listening to their events

Interstitial, Rewarded and App Open Ads

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

Native and Banner 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;
  }
});
  1. Internal error

Something happened internally; for instance, an invalid response was received from the ad server

  1. Invalid request

The ad request was invalid; for instance, the ad unit ID was incorrect

  1. Network error

The ad request was unsuccessful due to network connectivity

  1. No fill

The ad request was successful, but no ad was returned due to lack of ad inventory

From open ads

  1. Reused ad

You're reusing an ad. This will rarely happen because this error is handled by the plugin

  1. Ad not ready

The ad is not ready to be shown

  1. 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

Clone this wiki locally