广告插页式广告不可见

时间:2014-05-27 23:37:51

标签: android admob

大家好,我的广告插页式广告有问题。我在MainActivity中有一个横幅,但在另一个活动中,我希望显示插页式广告。横幅还可以......我能看到这个!但插页式广告并没有显示...... 这是我的代码:

public class Servizi extends FragmentActivity{

private InterstitialAd interstitial;

@Override
protected void onCreate(Bundle savedInstanceState) {

    super.onCreate(savedInstanceState);
    setContentView(R.layout.servizi);       


     // Create the interstitial.
    interstitial = new InterstitialAd(this);
    interstitial.setAdUnitId("ca-app-pub-....");

    // Create ad request.
//    AdRequest adRequest = new AdRequest.Builder().build();

    AdRequest adRequest = new AdRequest.Builder()
    .addTestDevice(AdRequest.DEVICE_ID_EMULATOR)        // All emulators
    .addTestDevice("B3EEABB8EE11C2BE770B684D95219ECB")  // Emulator id you will get in the LogCat verbose
    .build();
    // Begin loading your interstitial.
    interstitial.loadAd(adRequest);

    displayInterstitial();
  }

// Invoke displayInterstitial() when you are ready to display an interstitial.
public void displayInterstitial() {
  if (interstitial.isLoaded()) {
    interstitial.show();
  }
}

}

我的UnitID是正确的:有一个logcat。

    05-27 19:25:36.467: W/GooglePlayServicesUtil(2670): Google Play services is missing.
05-27 19:25:36.547: I/Ads(2670): Use AdRequest.Builder.addTestDevice("B3EEABB8EE11C2BE770B684D95219ECB") to get test ads on this device.
05-27 19:25:36.567: I/Ads(2670): Starting ad request.
05-27 19:25:37.467: I/Choreographer(2670): Skipped 120 frames!  The application may be doing too much work on its main thread.
05-27 19:25:38.927: I/Choreographer(2670): Skipped 60 frames!  The application may be doing too much work on its main thread.
05-27 19:25:47.457: I/Ads(2670): Scheduling ad refresh 60000 milliseconds from now.
05-27 19:25:47.457: I/Ads(2670): Ad finished loading.
05-27 19:25:48.077: I/Ads(2670): Ad finished loading.
05-27 19:26:47.497: I/Ads(2670): Ad is not visible. Not refreshing ad.
05-27 19:26:47.497: I/Ads(2670): Scheduling ad refresh 60000 milliseconds from now.
05-27 19:27:47.537: I/Ads(2670): Ad is not visible. Not refreshing ad.
05-27 19:27:47.537: I/Ads(2670): Scheduling ad refresh 60000 milliseconds from now.
05-27 19:28:47.617: I/Ads(2670): Ad is not visible. Not refreshing ad.

我使用的是4.4.2的模拟器,但我已尝试使用phisical设备,但不会在插页式广告中使用广告,但在主要活动工作中横幅很小!

我有GooglePlayService lib ...我的应用程序使用google-map API和admob小横幅......这没关系! 提前谢谢!

**已解决** 我已经实施了:

Solved: i have implemeted:

private class InterstitialAdListener extends AdListener {
    /** Called when an ad is loaded. */
    @Override
    public void onAdLoaded() {
          interstitial.show();

      Toast.makeText(Servizi.this, "onloaded", Toast.LENGTH_SHORT).show();
    }
}

1 个答案:

答案 0 :(得分:2)

您这样做不正确。

interstital.show()致电onAdLoaded。它会给用户带来很差的体验。

您应该从应用中的自然断点拨打interstitial.show()

此外,日志表示广告每60秒自动刷新一次。对于插页式广告,情况不应该发生。您需要显式加载并显示它们。这意味着您使用横幅广告AdUnitId而不是插页式广告adUnitId。

创建插页式广告adUnitId并改为使用它。