Admob insterstitial display a black screen

白昼怎懂夜的黑 提交于 2021-02-07 20:57:40

问题


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


回答1:


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




回答2:


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.




回答3:


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.



来源:https://stackoverflow.com/questions/22891918/admob-insterstitial-display-a-black-screen

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!