Skip to content Skip to sidebar Skip to footer

Admob Interstital Ads Not Displaying In Android

Hi I am trying to display interstital ads using admob but it's not displaying the ads. My code is as follows import com.google.android.gms.ads.AdRequest; import com.google.

Solution 1:

I guess while you are displaying your ad it is not loaded yet , so try this

interstitial= new InterstitialAd(this);
interstitial.setAdUnitId(AD_UNIT_ID);
interstitial.loadAd(new AdRequest.Builder().build();
}

interstitial.setAdListener(new AdListener() {
    @Override
    public void onAdLoaded() {
        super.onAdLoaded();
        interstitial.show();  // you can call this anywhere you want 

    }

    @Override
    public void onAdFailedToLoad(int errorCode) {
        super.onAdFailedToLoad(errorCode);

    }

});

Solution 2:

You can only display the ad after it is loaded. When you are calling displayInterstitial(), your ad may not be loaded. Register for a listener and that will tell you when the loading is done.

interstitial.setAdListener(new AdListener(){
    public void onAdLoaded(){
        displayInterstitial();
    }
});

Solution 3:

I am using the following code to display interstitial ad. It works perfect for me.

import com.google.android.gms.ads.AdRequest;

import com.google.android.gms.ads.InterstitialAd;

private InterstitialAd interstitial;

@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);

interstitial = new InterstitialAd(this);
interstitial.setAdUnitId(“**************************”);

AdRequest adRequest = new AdRequest.Builder().build();

interstitial.loadAd(adRequest);
interstitial.setAdListener(new AdListener(){
          public void onAdLoaded(){
               displayInterstitial();
          }
});
}

public void displayInterstitial() {
if (interstitial.isLoaded()) {
  interstitial.show();
  }
 }
} 

Post a Comment for "Admob Interstital Ads Not Displaying In Android"