Search code examples
androidadmobinterstitial

Don't load IntertitialAd, where did i go wrong?


InterstitialAd minterstitialAd;

protected void onCreate(Bundle savedInstanceState) {
minterstitialAd = new InterstitialAd(this);
        minterstitialAd.setAdUnitId(" ca-app-pub-XXXX/XXX");
        AdRequest adRequest1 = new AdRequest.Builder().build();
        minterstitialAd.loadAd(adRequest1);
}
public boolean onOptionsItemSelected(MenuItem item) {
    int id = item.getItemId();
    if (id == R.id.ayarlar_menu) {
         minterstitialAd.show();
     }
}

Don't load Ad. I add this code Work this code. Why Don't load my Ad? please help me. I try 3 days to resolve

minterstitialAd.setAdListener(new AdListener() {
            @Override
            public void onAdFailedToLoad(int errorCode) {
                txtsum.setText("asdas");
            }
        });

Solution

  • 1) In my case, interstitial ad don't showing because I used test ID for it. After I change it to normal ID problem gone.

    2) Before showing interstitial ad, check if it was already loaded. Maybe it still loading when you try to call it?