我在Android应用程序中使用AdMob视图,但我无法将任何广告添加到应用程序中。为什么AdMob返回NO FILL
仅供参考,我已经添加了查看到ListView由达恩·戴尔here
编辑解释说: 我使用GoogleAdMobAdsSdk-4.1.1。 Google AdMob广告SDK 4.1.0版的发布说明中提到:
“... ... - 增加了对AdRequest.addTestDevice()和AdRequest.setTestDevices()的支持请注意,AdRequest.setTesting()现在已被弃用。 ......”
这是广告是如何插入我的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的到AD浏览,并在每一个loadAd,该onFailedToReceiveAd回调方法被调用:
public void onFailedToReceiveAd(Ad arg0, ErrorCode arg1) {
Log.d(TAG, "AdMob in list failed to receive ad: " + arg1.name());
}
在logcat中我得到这个消息:
08-17 15:22:18.065: AdMob in list failed to receive ad: NO_FILL
谁能告诉我这是什么错误代码意味着什么?
我无法从此答案得出任何结论。我也面临同样的问题和我应该做的事情?我可以看到来自世界各地的广告请求(在admob仪表板中),但没有印象。 Logcat消息总是显示'没有填充':-( – Sanmoy