4

Lately I am getting black screens when displaying Interstitial ads using admob. This is the screen I am talking about:

enter image description here

Some time it works well and displays an ad correctly. This is the code I use:

    Class variable:
    private InterstitialAd oInterstitialAd=null;

    In the activity onCreate:
    oInterstitialAd = new InterstitialAd(this);
    oInterstitialAd.setAdUnitId(xxxxxxx);
    oInterstitialAd.setAdListener(new AdListener()
    {  @Override public void onAdLoaded() 
       {  oInterstitialAd.show();
          finish();
       }
       @Override public void onAdFailedToLoad(int errorCode) 
       {  LogError("onAdFailedToLoad " + errorCode);              
          finish();
       }
    });        
    AdRequest oAdRequest = new AdRequest.Builder().build();
    oInterstitialAd.loadAd(oAdRequest);

Thanks

Ton
  • 9,235
  • 15
  • 59
  • 103

4 Answers4

1

I am having the same issue.

Check by switching between devices and wifi networks. Mostly its the problem of your wifi which the google has added to the temporary blacklist.

If it works on other devices or other networks. It's not the issue with ads its problem with device or network.

Ford Ramsaki
  • 131
  • 1
  • 8
0

Don't call interstitial.show() from the AdListener. This will generate a really poor user experience as the ad can show up in mid game etc.

You should instead call interstitial.show() from a natural break point in your app.

I also think it's highly unlikely that you want to be calling Activity.finish() from the AdListener methods.

You didn't mention what version of Admob you are using but it is not the current Google Play Services version. This may be causing your display problems.

William
  • 20,150
  • 8
  • 49
  • 91
  • how can you tell I am not using the latest one? I think I have the one I downloaded about a month ago. – Ton Apr 08 '14 at 20:20
  • My bad. I mistakenly thought the #show method was now #displayInterstitial. I ave no idea what version of Admob you are using :-) – William Apr 09 '14 at 04:52
0

Wait for some time, it's loading. The network speed is slow

Gank
  • 4,507
  • 4
  • 49
  • 45
0

You should instead call interstitial.show() inside onAdLoaded. That solves the problem for me.

Dr Mido
  • 2,414
  • 4
  • 32
  • 72