admob 未显示在应用程序(模拟器或设备)中

发布于 2024-12-26 18:21:13 字数 2020 浏览 0 评论 0原文

我尝试添加 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&region=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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

满天都是小星星 2025-01-02 18:21:13

这说明了一切。

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.

魔法唧唧 2025-01-02 18:21:13

我有同样的问题。但我认为 Google Admob 常见问题解答有答案
https://developers.google.com/mobile-ads-sdk/kb/ #whynoads

引用:

我认为我已经正确实现了所有内容,所以为什么我没有看到
广告?

虽然保持尽可能高的填充率是我们的首要任务之一
优先级,我们可能并不总是为每个广告提供一个可用的广告
要求。这在开发过程中尤其常见,当广告
请求通常很少由少数用户发出
和设备。当应用程序在 AdMob 上新注册时,还可能需要
展示次数之前的一段时间和多次请求是一致的
发表。开发人员通常会看到更一致的结果
已经发布了他们的应用程序,广告请求更频繁地来自
用户群更加多元化。

注意:AdMob 第一次看到您的发布商 ID 时可能会占用
到两分钟才能收到广告,并且最初的两分钟延迟将
每次应用程序在 24 小时内未使用时都会重复发生。

是的,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:

I think I've implemented everything correctly, so why am I not seeing
ads?

While maintaining the highest possible fill rate is one of our top
priorities, we may not always have an ad available for every ad
request. This can be especially common during development, when ad
requests are typically made infrequently from a small number of users
and devices. When apps are newly registered on AdMob it may also take
some time and several requests before impressions are consistently
delivered. Developers generally see more consistent results once they
have released their app and ad requests arrive more frequently from a
more diverse user base.

Note: The very first time AdMob sees your publisher ID it may take up
to two minutes to receive an ad, and this initial two minute lag will
recur every time the app goes unused for 24 hours.

And yes, the admob reports showing low request count.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文