android studio:插页式广告未显示在初始屏幕活动中

时间:2018-09-01 15:11:36

标签: android admob ads interstitial

我正在尝试通过使用此tutorial ..将插页式广告集成到初始屏幕活动中,但是广告没有加载。

谁能告诉我问题出在哪里?

预先感谢

这是我的代码:

mInterstitialAd = new InterstitialAd(this);
    mInterstitialAd.setAdUnitId(getString(R.string.interstitial_full_screen));
    mInterstitialAd.setAdListener(new AdListener()


{
    @Override
    public void onAdLoaded() {
        if (!interstitialCanceled) {
            waitTimer.cancel();
            mInterstitialAd.show();
        }
    }

    @Override
    public void onAdFailedToLoad(int errorCode) {
        startHomeMain();
    }
});

waitTimer = new Timer();
waitTimer.schedule(new TimerTask() {
    @Override
    public void run() {
        interstitialCanceled = true;
        SplashScreenActivity.this.runOnUiThread(new Runnable() {
            @Override
            public void run() {
                startHomeMain();
            }
        });
    }
}, 5000);
} // end of onCreate implementation.

0 个答案:

没有答案