我有最新的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使用率很高
发布评论