正在载入广告,但不会显示? [英] Ads are loading, but not showing?

查看:306
本文介绍了正在载入广告,但不会显示?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已遵循条路线,广告载入成功,但在我呼叫 mInterstitialAd.show(); 时不显示:

I have followed these directions, and the ads load succesfully, but don't show when I call mInterstitialAd.show();:

In onCreate():

 mInterstitialAd = new InterstitialAd(this);
    mInterstitialAd.setAdUnitId("My ID");

    mInterstitialAd.setAdListener(new AdListener() {
        @Override
        public void onAdClosed() {
            requestNewInterstitial();
            beginPlayingGame();
        }
    });
        requestNewInterstitial();

requestNewInterstitial()

requestNewInterstitial():

  private void requestNewInterstitial() {
        AdRequest adRequest = new AdRequest.Builder()
                .addTestDevice("Phone's ID")
                .build();

        mInterstitialAd.loadAd(adRequest);
    }

这是问题:

HERE IS THE PROBLEM:

 public void tryAgain(View v) {
        if (mInterstitialAd.isLoaded()) {

            mInterstitialAd.show();
            Log.v(TAG, "LOADED in Game Over!");

        }
       else {
            beginPlayingGame();
        }

        beginPlayingGame();
    }

我得到的日志说它被加载到我的日志猫,实际上不显示! 为什么要加载,但不显示?

I get the log saying it is loaded in my log cat, but the ad doesn't actually show! Why is it loading, but not showing?

我想我实际上已经让它工作一次,但从那以后它停止工作。可能是什么问题?

P.S. I think I actually got it to work once earlier, but it stopped working ever since then. What could be the problem?

推荐答案

原来,我只需要删除额外的方法调用之后的。例如,

It turns out that I just had to remove the extra method call after the else. For example,

public void tryAgain(View v) {
        if (mInterstitialAd.isLoaded()) {

            mInterstitialAd.show();
            Log.v(TAG, "LOADED in Game Over!");

        }
       else {
            beginPlayingGame();
        }

        beginPlayingGame();
    }

应该刚才

public void tryAgain(View v) {
        if (mInterstitialAd.isLoaded()) {

            mInterstitialAd.show();
            Log.v(TAG, "LOADED in Game Over!");

        }
       else {
            beginPlayingGame();
        }
    //NOTICE THERE Is NO EXTRA METHOD CALL OF **beginPlayingGame()**
      }

这篇关于正在载入广告,但不会显示?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆