AdMob的横幅导致CPU使用率很高

编程入门 行业动态 更新时间:2024-10-21 11:28:50
本文介绍了AdMob的横幅导致CPU使用率很高的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我有最新的AdMob的版本(6.4.1),当我表现出一定的旗帜其原因我的CPU开始出汗(更不用说电池:S)。

我破坏AD浏览报,当我离开的活动,但是当活动开始,大约需要20%的CPU使用率。

有什么办法解决?为什么CPU使用率如此之高时,广告显示?

解决方案   

有2种不同的AdMob的实现测试我的应用程序,我发现   即通过Java code实现它,而不是XML是匹配打火机   该应用程序。

     

更新NO1:

     

您还可以添加自定义的听众一段时间后销毁和   重新以处理它甚至更好。服务器端也有一个   参数告诉应用程序的广告多久应该要求一个新的广告,我   如果它存在于所有的情况下,但它是有DFP帐户不能确定。

     

有一个很好的建议的方式来实施的广告是:

新的处理程序(新Handler.Callback(){ @覆盖 公共布尔的handleMessage(信息MSG){   如果(!isBeingDestroyed){       最后AdRequest adRequest =新AdRequest();       最终AD浏览报AD浏览报=(AD浏览报)findViewById(R.id.ad);       adView.loadAd(adRequest);   } })sendEmptyMessageDelayed(0,1000)。

     

也不要忘了叫 adView.destroy()的onDestroy()   活动或当你不想要了!

     

以上方式提到[这里] [1]许多有用的内存版本!

完整的答案就在这里:stackoverflow/a/14683378/1932105

请使用寻找下一次。祝你好运

I have the latest AdMob version (6.4.1), and when I show some banner its cause my CPU to start sweating (Not to mention the battery :S ).

I am destroying the AdView when I leave the activity, but when the activity is started it takes about 20% of CPU usage.

Is there any way to fix it? Why the CPU usage is so high when the ads are shown?

解决方案

Having test my app with 2 different implementations of AdMob I found that implementing it via java code and not XML is match lighter for the app.

Update No1:

You can also add custom listeners to destroy after some time and recreate in order to handle it even better. Serverside there is also a parameter telling the app ad how soon should ask for a new ad, I am not sure if it exist in all cases but it is there for DFP accounts.

A nice suggested way to implement the ad is that:

new Handler(new Handler.Callback() { @Override public boolean handleMessage(Message msg) { if (!isBeingDestroyed) { final AdRequest adRequest = new AdRequest(); final AdView adView = (AdView) findViewById(R.id.ad); adView.loadAd(adRequest); } }).sendEmptyMessageDelayed(0, 1000);

also do not forget to call adView.destroy() onDestroy() activity or when you do not want it any more!

The above way is mentioned [here][1] with many useful memory releases!

the complete answer is here: stackoverflow/a/14683378/1932105

please use the search next time. Good luck

更多推荐

AdMob的横幅导致CPU使用率很高

本文发布于:2023-10-27 15:49:41,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1533833.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:横幅   率很高   AdMob   CPU

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!