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 with many useful memory releases!
the complete answer is here: https://stackoverflow.com/a/14683378/1932105
please use the search next time. Good luck
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With