首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >Admob提前本地广告获取背景?

Admob提前本地广告获取背景?
EN

Stack Overflow用户
提问于 2020-11-02 06:05:02
回答 1查看 374关注 0票数 1

加载admob广告会使应用程序的启动非常滞后,看起来admob使用了运行在UI线程上的WKWebview。

如果我在后台提取广告(获取数据而不显示它们为),并将它们保存在内存中,以便当应用程序启动或到前台时,它不会滞后吗?是否有任何反对这方面的指引?

我的用户通常每2-3个小时访问一次应用程序,因此很有可能该应用程序不会被杀死,广告将保留在记忆中供将来使用。

EN

回答 1

Stack Overflow用户

发布于 2020-11-02 06:34:05

https://developers.google.com/admob/android/banner#load_an_ad

请参阅此声明注意:在主线程.上调用Mobile

还请参考此链接https://groups.google.com/g/google-admob-ads-sdk/c/NBpj7fy7wYc

代码语言:javascript
复制
Hi everyone,

Below are my responses to your concerns:

    I am having the same issue with my app, this MobileAds.initialize() method, when used as prescribed, is responsible for a huge part of my app startup time.  A median of 405ms and a p95 of 1.5 seconds.


It is important to note that initializing the SDK using the MobileAds.initialize() method is optional. Also, if you decided not to call this method, the SDK will be initialized automatically on your very first Ad request which might increase the Ads load time to a few milliseconds more, similar to what Minas have observed. That said, you should be able to load Ads with or without implementing the MobileAds.initialize() as it is mainly for the purpose of initializing the SDK ahead to decrease load time on the first Ad request.

     Is it safe to run the MobileAds.initialize() method on a background thread instead of running it on the main UI thread?


Please note that according to this guide, all calls to the Mobile Ads SDK such as the MobileAds.initialize() should be executed on the main thread and not in the background thread.

Regards,
Steven Balan
Mobile Ads SDK Team
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/64640553

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档