Android Admob Error Code 1 The ad has already been shown

Viewed 209

I am encountering a new kind of error with Admob.

The ad is being shown but im getting this error when onAdFailedToShowFullScreenContent is being triggered .

{ "Code": 1, "Message": "The ad has already been shown.", "Domain": "com.google.android.gms.ads", "Cause": "null" }

does anyone know the reason behind this code? and how am I supposed to handle it ?

1 Answers

You need to make sure to dispose your ad after showing it, like so:

interstitialAd.fullScreenContentCallback = FullScreenContentCallback(
  onAdDismissedFullScreenContent: (ad) {
    print('onAdDismissedFullScreenContent');
    ad.dispose();
  },
  onAdFailedToShowFullScreenContent: (ad, error) {
    print('onAdFailedToShowFullScreenContent: $error');
  },
  onAdShowedFullScreenContent: (ad) {
    print('onAdShowedFullScreenContent');
  },
);
interstitialAd.show();

In addition, don't forget to initialize it again before next time your show it.

Related