当前位置: 首页 > 知识库问答 >
问题:

广告间隙不可见

傅鸿波
2023-03-14

嗨,伙计们,我的广告插页有问题。我在主活动中有一个横幅,但在另一个活动中,我想显示一个插页广告。横幅可以。。。我能看到这个!但间隙并没有显示。。。这是我的代码:

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中使用了模拟器,但我在物理设备上进行了尝试,但没有在中间位置使用广告,但在主活动中使用了小横幅!

我有GooglePlayService库...我的应用程序使用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个答案

曹建明
2023-03-14

你这样做是错误的。

不要调用interstital.show()fromonAdLoed。这会给用户体验很差。

您应该调用interstival。从应用程序中的自然断点显示()。

此外,日志指示ad每60秒自动刷新一次。这不应该发生在间隙广告中。您需要显式加载并显示它们。这意味着你使用的是横幅式的奉承,而不是间隙式的奉承。

创建一个间隙adUnitId并改用它。

 类似资料:
  • 我成功地在我的应用程序中实现了AdMob中间广告,但唯一的问题是它们不可点击。 下面是我的AdMob.java类: 和MainPageActivity.java文件: 我不知道当用户升级并按下播放按钮(这将引导他进入下一个级别)时,该如何显示间隙广告。当他按下home键时,间隙广告就会出现,这会把他带到MainActivity屏幕上。 有人能帮我把广告点击一下吗?另外,有什么建议,如何添加的间隙广

  • 我想在Google Play的“专为家庭设计”类别中为儿童制作应用程序。据此:https://support.google.com/googleplay/android-developer/answer/6184502有两条规则: 不得使用广告墙 插播广告不得在应用程序启动后立即显示 请您解释一下如何使间质广告不全屏(不是广告墙)? 广告墙和插页广告有什么区别? 我曾经用过这个填隙词:https:

  • 我正在遵循本教程 到目前为止,当我点击按钮时,它就可以工作了。然而,我似乎无法让它在viewDidLoad上显示中间广告。 这就是我所拥有的: 控制台不断向我显示: 2016-02-04 22:27:51.855 GoogleAdamObjutorial[3394:56415]要获取此设备上的测试广告,请致电:request。testDevices=@[kGADSimulatorID]; 单击按钮

  • 我正在完成一个视频应用程序,我在离开视频activity时显示间隙广告。我只想每X分钟显示一次,但似乎每次我离开那个屏幕时它都在显示。 这是我的activity密码。 onCreate: onbackpressed: 当然,在admob中是这样设置的: 注意:我的应用程序没有发布,所以它正在显示“预览”o“示例”。我正在使用我的广告单元ID: 谢谢,

  • 我想在一定的时间间隔后,在主要活动上添加一个间隙广告。我搜索,似乎没有参考代码这样做。感谢你的帮助我该怎么做?任何示例代码都将是有用的。多谢了。

  • 我想在我的viewPager中添加间隙广告,但一旦间隙广告关闭(或打开时),我就遇到了容器“消失”(或被销毁)的问题。一旦滑动,就会自动调用@Override方法“public void destructionitem(ViewGroup container,int position,Object Object)”,并调用间隙ad,但是,视图不会像未调用间隙ad时那样再次膨胀。 我的类扩展了Pag