admob 未显示在应用程序(模拟器或设备)中
我尝试添加 admob,但遇到一些问题。 这是测试的代码,看起来不错:
AdView adView = new AdView(this, AdSize.BANNER, pubID);
AdRequest adRequest = new AdRequest();
adRequest.addTestDevice(AdRequest.TEST_EMULATOR); // Emulator
adRequest.addTestDevice("TEST_DEVICE_ID");
adView.loadAd(adRequest);
这段带有 pubID 的代码
AdView adView = new AdView(this, AdSize.BANNER, pubID);
adView.loadAd(new AdRequest());
我不明白出了什么问题......只是 admob 没有显示。仅此而已...
谁能帮我解决这个问题吗? 问候,彼得。
UPD哦,抱歉。还有清单文件中设置的所有设置(权限和 AdSense 活动)
upd logcat 中 admob 的所有响应:
01-11 21:49:31.805: I/Ads(363): To get test ads on this device, call adRequest.addTestDevice(AdRequest.TEST_EMULATOR);
01-11 21:49:33.405: I/Ads(363): adRequestUrlHtml: <html><head><script src="http://media.admob.com/sdk-core-v40.js"></script><script>AFMA_buildAdURL({"preqs":0,"u_sd":1,"slotname":"a14f0d9ca22bc53","u_w":320,"msid":"activityM.activity.com","simulator":1,"cap":"m,a","js":"afma-sdk-a-v4.3.1","isu":"B3EEABB8EE11C2BE770B684D95219ECB","cipa":0,"format":"320x50_mb","net":"ed","app_name":"1.android.activityM.activity.com","hl":"en","u_h":480,"u_audio":4});</script></head><body></body></html>
01-11 21:49:41.714: I/Ads(363): Received ad url: <"url": "http://googleads.g.doubleclick.net:80/mads/gma?preqs=0&u_sd=1&slotname=a14f0d9ca22bc53&u_w=320&msid=activityM.activity.com&cap=m%2Ca&js=afma-sdk-a-v4.3.1&isu=B3EEABB8EE11C2BE770B684D95219ECB&cipa=0&format=320x50_mb&net=ed&app_name=1.android.activityM.activity.com&hl=en&u_h=480&u_audio=4&u_so=p&output=html®ion=mobile_app&u_tz=0&ex=1&client_sdk=1&pto=0&jsv=1", "afmaNotifyDt": "null">
01-11 21:49:42.255: I/Ads(363): onFailedToReceiveAd(Ad request successful, but no ad returned due to lack of ad inventory.)
这就是我在 ddms 中找到的所有内容。
I try to add admob, but I have some problem with it.
This is the code for the test, it looks ok:
AdView adView = new AdView(this, AdSize.BANNER, pubID);
AdRequest adRequest = new AdRequest();
adRequest.addTestDevice(AdRequest.TEST_EMULATOR); // Emulator
adRequest.addTestDevice("TEST_DEVICE_ID");
adView.loadAd(adRequest);
And this code with pubID
AdView adView = new AdView(this, AdSize.BANNER, pubID);
adView.loadAd(new AdRequest());
I can't understand what's wrong... Just admob is not showing. That's all...
Can anyone help me with this problem?
Regards, Peter.
UPD oh sorry. Also all settings set in manifest file( permission , and adsense activity)
upd
all response from admob in logcat :
01-11 21:49:31.805: I/Ads(363): To get test ads on this device, call adRequest.addTestDevice(AdRequest.TEST_EMULATOR);
01-11 21:49:33.405: I/Ads(363): adRequestUrlHtml: <html><head><script src="http://media.admob.com/sdk-core-v40.js"></script><script>AFMA_buildAdURL({"preqs":0,"u_sd":1,"slotname":"a14f0d9ca22bc53","u_w":320,"msid":"activityM.activity.com","simulator":1,"cap":"m,a","js":"afma-sdk-a-v4.3.1","isu":"B3EEABB8EE11C2BE770B684D95219ECB","cipa":0,"format":"320x50_mb","net":"ed","app_name":"1.android.activityM.activity.com","hl":"en","u_h":480,"u_audio":4});</script></head><body></body></html>
01-11 21:49:41.714: I/Ads(363): Received ad url: <"url": "http://googleads.g.doubleclick.net:80/mads/gma?preqs=0&u_sd=1&slotname=a14f0d9ca22bc53&u_w=320&msid=activityM.activity.com&cap=m%2Ca&js=afma-sdk-a-v4.3.1&isu=B3EEABB8EE11C2BE770B684D95219ECB&cipa=0&format=320x50_mb&net=ed&app_name=1.android.activityM.activity.com&hl=en&u_h=480&u_audio=4&u_so=p&output=html®ion=mobile_app&u_tz=0&ex=1&client_sdk=1&pto=0&jsv=1", "afmaNotifyDt": "null">
01-11 21:49:42.255: I/Ads(363): onFailedToReceiveAd(Ad request successful, but no ad returned due to lack of ad inventory.)
That's all what i found in ddms.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
这说明了一切。
01-11 21:49:42.255: I/Ads(363): onFailedToReceiveAd(广告请求成功,但由于广告库存不足而没有返回广告。)
我有时会遇到这种情况。无论出于何种原因,他们目前都没有任何广告可发送。当他们的库存中有东西时,它们最终会弹出。没什么可担心的,只要继续检查,它最终就会弹出。
This tells all.
01-11 21:49:42.255: I/Ads(363): onFailedToReceiveAd(Ad request successful, but no ad returned due to lack of ad inventory.)
This has happened to me sometimes. They just don't have any ads to send out at the moment for whatever reason. They will eventually pop up when they have something in their inventory. Nothing to worry about, just keep checking and it will eventually pop up.
我有同样的问题。但我认为 Google Admob 常见问题解答有答案
https://developers.google.com/mobile-ads-sdk/kb/ #whynoads
引用:
是的,admob 报告显示请求数较低。
I have the same problem. But I think the Google Admob FAQ has the answer
https://developers.google.com/mobile-ads-sdk/kb/#whynoads
Quote:
And yes, the admob reports showing low request count.