lostkids
lostkids

Reputation: 1

Why my interstitial ads always load/show on app

i had success Implementation interstitial ads admob but i have 1 problem, why interstitial ads always show every second on my app, so i cannot play my app because this interstitial ads

any want help me how to make interstitial ads show only 1 interstitial ads every app lauch

here my code on my app Activity :

public class Activity extends Activity implements AdListener {
    WebView mWebView;
    private InterstitialAd interstitial;

    .......

    interstitial = new InterstitialAd(this, "a15xxxxxxxxxx");
    AdRequest adRequest = new AdRequest();
    interstitial.loadAd(adRequest);
    interstitial.setAdListener(this);

    .......

    public void onReceiveAd(Ad ad) {
          Log.d("OK", "Received ad");
          if(interstitial.isReady()) {
             interstitial.show();
          }
    }

Upvotes: 0

Views: 2496

Answers (2)

VenomVendor
VenomVendor

Reputation: 15422

Migrate from AdMob to google-play-services, AdMob is deprecated

You should show your ad if .isLoaded()

if (interstitial.isLoaded()) {
  interstitial.show();
} else {
  Log.d(LOG_TAG, "Interstitial ad was not ready to be shown.");
}

Here is an example for Interstitial ads

Upvotes: 1

William
William

Reputation: 20196

Your problem may well be caused by you showing your ad as soon as it is received (ie onAdReceived). For interstitials you should show the ad at a natural break point in your app instead.

Upvotes: 0

Related Questions