AdMob still running after close the app

207 views
Skip to first unread message

David Fortunato

unread,
Jun 24, 2014, 5:42:35 AM6/24/14
to google-adm...@googlegroups.com
Hello,

I use a Banner from AdMob on bottom of my app in every screens, I use the resume(), pause() and destroy() methods on AdView like developers docs says, but when I leave the app I see the CPU consumption and my app stills running. I know that this issue is related with AdMob because when I remove the AdMob banner from my code everything works great. Anyone can help me solve this issue?

PS: This usually appear when the AdView have an animation (i.e. Texts animations).

David Fortunato

unread,
Jun 25, 2014, 6:08:44 AM6/25/14
to google-adm...@googlegroups.com
Please, help me with this. I forgot to mention that this is happening in Android OS.

Amy Quispe (AdMob SDK Team)

unread,
Jul 2, 2014, 5:05:23 PM7/2/14
to google-adm...@googlegroups.com
Hi David,

Is the adView destroyed when you leave the app? Could you post some code and maybe a stack trace?

Amy Quispe

David Fortunato

unread,
Jul 3, 2014, 10:25:22 AM7/3/14
to google-adm...@googlegroups.com
I trying to destroy it with destroy() method, but nothing happening. Also, I create a new project only with AdMob banner, and this issue still happening. This is my code:

public class MainActivity extends Activity {
   
private AdView adView;
   
   
@Override
   
protected void onCreate(Bundle savedInstanceState) {
       
super.onCreate(savedInstanceState);
        setContentView
(R.layout.main_activity);
       
        adView
= new AdView(this);
       
        adView
.setAdUnitId(<AdUnitId>);
        adView
.setAdSize(AdSize.BANNER);
       
((ViewGroup) findViewById(R.id.advertiseLayout)).addView(adView);
       
AdRequest adRequest = new AdRequest.Builder().build();
       
        adView
.loadAd(adRequest);
   
}

   
@Override
   
protected void onResume() {
       
super.onResume();
        adView
.resume();
   
}

   
@Override
   
protected void onPause() {
        adView
.pause();
       
       
super.onPause();
   
}

   
@Override
   
protected void onDestroy() {
       
       
((ViewGroup) findViewById(R.id.advertiseLayout)).removeView(adView);
        adView
.destroy();
        adView
= null;

       
super.onDestroy();
   
}
   
}

Kunal Verma

unread,
Jul 6, 2014, 11:24:48 PM7/6/14
to Google AdMob Ads Developers
Hey David,
 
Can you tell us what you mean by leaving the app. Is it the Home Button? or the Back button? With back button, onDestroy is called. 
Have you tried the AdMob official sample app? The reason I recommend is because in one of my apps, I use singleInstance as the launchMode for one of my activities which bypasses the activity closing on back button. So it doesn't get destroyed. Rather it makes the back button similar to home button with 2-3 lines of more code if moving from one activity to another.

Talking about Home button, adView.pause() shall work. For me, I have set the refresh rate at 45 seconds and I don't see another Ad being called during the paused duration of app.

Best,
Kunal


--

---
You received this message because you are subscribed to the Google Groups "Google AdMob Ads Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-admob-ads...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

David Fortunato

unread,
Jul 10, 2014, 1:09:45 PM7/10/14
to google-adm...@googlegroups.com
When I say "leaving the app" obviously I mean "press back button". I know that destroy is called, but the issue here is that destroy() method don't do anything at all. I also tryed a lot of other Ad Providers and none of them makes memory leaks like AdMob does. It's really shame...
To unsubscribe from this group and stop receiving emails from it, send an email to google-admob-ads-sdk+unsub...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages