0

我成功实施了插页式广告 admob,但我有 1 个问题,为什么插页式广告总是在我的应用程序上每秒显示一次,所以我无法播放我的应用程序,因为这个插页式广告

任何人都想帮助我如何让插页式广告在每次应用启动时只显示 1 个插页式广告

这是我的应用程序 Activity 上的代码:

public class Activity extends Activity implements AdListener {
    WebView mWebView;
    private InterstitialAd interstitial;

    .......

    interstitial = new InterstitialAd(this, "a15xxxxxxxxxx");
    AdRequest adRequest = new AdRequest();
    interstitial.loadAd(adRequest);
    interstitial.setAdListener(this);

    .......

    public void onReceiveAd(Ad ad) {
          Log.d("OK", "Received ad");
          if(interstitial.isReady()) {
             interstitial.show();
          }
    }
4

2 回答 2

1

从 AdMob 迁移到 google-play-services,AdMob 已弃用

如果出现以下情况,您应该展示您的广告.isLoaded()

if (interstitial.isLoaded()) {
  interstitial.show();
} else {
  Log.d(LOG_TAG, "Interstitial ad was not ready to be shown.");
}

这是插页式广告的示例

于 2014-02-28T03:06:12.800 回答
0

您的问题很可能是因为您在收到广告后立即展示广告(即 onAdReceived)。对于插页式广告,您应该改为在应用的自然断点处展示广告。

于 2014-03-02T02:20:26.030 回答