为什么 AdMob 返回 NO FILL

Why does AdMob return NO FILL(为什么 AdMob 返回 NO FILL)
本文介绍了为什么 AdMob 返回 NO FILL的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在 Android 应用中使用 AdMob 视图,但无法将任何广告放入应用中.

I'm using an AdMob view in an android app, but I'm unable to get any ad into the app.

作为参考,我已按照 Dan Dyer 的解释将视图添加到 ListView 这里

For reference, I've added the view to a ListView as explained by Dan Dyer here

我正在使用 GoogleAdMobAdsSdk-4.1.1.Google AdMob Ads SDK 4.1.0 版的发行说明说:

I'm using GoogleAdMobAdsSdk-4.1.1. The release notes of Google AdMob Ads SDK for version 4.1.0 says:

"...- 添加了对 AdRequest.addTestDevice() 和 AdRequest.setTestDevices() 的支持.请注意,现在不推荐使用 AdRequest.setTesting().……"

"... - Added support for AdRequest.addTestDevice() and AdRequest.setTestDevices(). Note that AdRequest.setTesting() is now deprecated. ..."

这是将广告插入到我的 ListView 中的方式:

This is how the ad is inserted to my ListView:

public View getView(int position, View convertView, ViewGroup parent) {

  // Some other code
  // Reusing convertView etc.

  AdView adView = 
     new AdView((Activity) getContext(), AdSize.BANNER, 
     "/xxxxxx/ca-pub-xxxxxxx/my_ad_unit");
  for (int i = 0; i < adView.getChildCount(); i++) {
    adView.getChildAt(i).setFocusable(false);
  }
  adView.setFocusable(false);
  float density = getContext().getResources().getDisplayMetrics().density;
  int height = Math.round(50 * density);
  AbsListView.LayoutParams params = new AbsListView.LayoutParams(
    AbsListView.LayoutParams.FILL_PARENT, height);

  adView.setLayoutParams(params);
  AdRequest request = new AdRequest();
  request.addTestDevice("xxxxxxxxxxxxxxxxx");
  adView.loadAd(request);

  // other stuff
  // returning convertView
}

我还在广告视图中添加了一个 AdListener,并且在每个 loadAd 上,都会调用 onFailedToReceiveAd 回调方法:

I've also added an AdListener to the adview, and on every loadAd, the onFailedToReceiveAd callback method is called:

public void onFailedToReceiveAd(Ad arg0, ErrorCode arg1) {
  Log.d(TAG, "AdMob in list failed to receive ad: " + arg1.name());
}

在 logcat 中我收到以下消息:

In logcat I get this message:

08-17 15:22:18.065: AdMob in list failed to receive ad: NO_FILL

谁能告诉我这个错误码是什么意思?

Can anyone tell me what this errorcode means?

推荐答案

回答问题:

当没有剩余广告资源时,AdMob 会返回 NO_FILL在 AdMob/DFP 后端投放.

首先,这意味着我请求的是 AxB 尺寸的广告,但后端没有该尺寸的广告可以展示.请务必在 AdMob/DFP 的后端系统中保留您请求的尺寸的广告资源.

First of all this meant I was requesting an ad of size AxB, but the backend had no ads of this size left to show. It is important that the size you request has inventory left in the backend systems of AdMob/DFP.

其次,他们的 API 规定,当您第一次向特定广告单元请求广告时,您应该在广告开始投放前最多两分钟.不知道是不是因为我没有驻扎在美国,但是这两分钟对我来说经常变成至少20分钟,如果不是几个小时.

Second, their API states that the first time you request an ad to a specific ad unit, you should expect up to two minutes before the ads start serving. I don't know if it is because I am not stationed in the US, but these two minutes often becomes at least 20 minutes if not several hours for me.

这篇关于为什么 AdMob 返回 NO FILL的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!

本站部分内容来源互联网,如果有图片或者内容侵犯您的权益请联系我们删除!

相关文档推荐

How to target newer versions in .gitlab-ci.yml using auto devops (java 11 instead of 8 and Android 31 instead of 29)(如何在.gitlab-ci.yml中使用自动开发工具(Java 11而不是8,Android 31而不是29)瞄准较新的版本)
Android + coreLibraryDesugaring: which Java 11 APIs can I expect to work?(Android+core LibraryDesugering:我可以期待哪些Java 11API能够工作?)
How to render something in an if statement React Native(如何在If语句中呈现某些内容Reaction Native)
How can I sync two flatList scroll position in react native(如何在本机Reaction中同步两个平面列表滚动位置)
Using Firebase Firestore in offline only mode(在仅脱机模式下使用Firebase FiRestore)
Crash on Google Play Pre-Launch Report: java.lang.NoSuchMethodError(Google Play发布前崩溃报告:java.lang.NoSuchMethodError)