【问题标题】:Admob Interstitials ErrorAdmob 插页式广告错误
【发布时间】:2013-09-26 13:53:06
【问题描述】:

我想调用 Admob 插页式广告?在我的 Android 应用程序中多次。我完全把这件事弄糊涂了。

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

我尝试了这段代码,这对于一次调用来说效果很好。当它第二次调用时显示错误。

帮我解决这个问题。

提前致谢。

【问题讨论】:

  • 可能加上错误的logcat?

标签: android admob andengine


【解决方案1】:

您需要将 Interstitial 的构建、加载广告和展示广告分开。

public void onCreate(Bundle savedInstanceState) {
  interstitial = new InterstitialAd(this, "MY-AD-ID");
  interstitial.setAdListener(new AdListsner() {
     ..
  });
}

private void loadAd() {
  final AdRequest adRequest = new AdRequest();
  interstitial.loadAd(adRequest);
}

private void showAd() {
  if (interstitial.isLoaded()) {
    interstitial.show();
  }
}

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2020-09-21
    • 2018-01-03
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多