为什么测试横幅需要这么长时间才能加载到设备上 [英] Why do test banners take such a long time to load on device

查看:71
本文介绍了为什么测试横幅需要这么长时间才能加载到设备上的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我目前正在从事iAd/AdMob中介服务.模拟器中的测试横幅几乎立即加载.最多需要3-5秒的等待时间.但是,在实际设备上,有时这些测试标语在30秒内不会加载,甚至根本不会加载.没有人等待广告加载,因此,如果广告加载时间太长,我将永远不会获得报酬.直播广告是否也会发生这种情况,还是仅在设备上测试广告?是否有代码可以使广告在屏幕上更快地投放?

I'm currently working on iAd/AdMob mediation. The test banners in the simulator load almost instantly. At most there is a 3-5 second wait. However, on actual device, sometimes those test banners don't load for 30 seconds or don't even load at all. Nobody waits for ads to load, so i'll never get paid if the ads take so long to load. Does this happen with live ads too or only test ads on device? Is there a code to make the ads load faster on screen?

推荐答案

嗯,有点迟了,但是我希望我能帮助别人:

Well, a bit late, but I hope I can help someone:

诀窍是在展示广告之前加载广告,而不是在您想要展示广告的确切时间加载广告.并通过代码而不是XML加载它们!

The trick is loading the ads some time BEFORE showing them, not at the exact moment when you want to show them. And load them by code, not XML!

通常,我在进入活动或什至在启动活动(第一个加载活动)中加载它们.然后,当您想要展示它们时,您只需要调用ad.show()(对于非页内广告和视频广告而言).

Normally I load them when I enter the activity or even in the splash activity (the first loading activity). Then when you want to show them you only need to call ad.show() (in the case of interstitial and video ads).

使用横幅广告也很容易:您可以通过代码(而非xml)创建AdView并调用loadAd,因此可以加载,但可以将AdView存储在变量中,而不是将其放置在视图中.然后,当您输入带有横幅的活动时,便将该视图添加到布局中.

With banners it's easy too: you create the AdView by code (not xml) and call loadAd, so it loads, but you store the AdView in a variable, instead of placing it in the view. And later on, when you enter the activity with the banner, you add that view to a layout.

额外:也许是您的意思:我意识到插页式广告和视频之类的广告有时在您展示它们后有时无法加载,因此在广告关闭事件中,我将其重置(我再次对其进行定义并将其存储在相同的位置变量),然后它们可以完美运行.

EXTRA: Perhaps what you mean: I realized that ads like interstitial and videos sometimes don't load after you already showed them, so in the ad close event, I reset them (I define them again and store it in the same variable), and then they work perfectly.

所以,总结:

  • 在显示横幅之前尽快加载横幅.

  • Load banners as soon as possible, before showing them.

在关闭事件中关闭横幅广告后(横幅广告和视频广告)重新创建.

Re-create banners once they are closed (interstital and videos) in the close event.

这篇关于为什么测试横幅需要这么长时间才能加载到设备上的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆