How to use the same admob banner instance across activities?

598 Views Asked by At

How to use the same AdMob banner instance across activities? I don't want the banner to load again and again if my user switches screens swiftly. I think it's lowering my CTR quite a bit.

Is there any way I can use the same AdMob banner 'instance' across different activities? I just want to stick the banner at the bottom (or top) of the screen and just use the rest of the screen for my app, moving in and out of activities while the banner stays put.

(Not to be too intrusive, my users can just turn off their internet and the ads won't appear. My app is completely offline)

Is there any way I can use the same AdMob banner 'instance' across different activities? I just want to stick the banner at the bottom (or top) of the screen and just use the rest of the screen for my app, moving in and out of activities while the banner stays put.

2

There are 2 best solutions below

4
Vir Rajpurohit On BEST ANSWER

Banner Ads itself is a View. So you can use it as a View only

I just want to stick the banner at the bottom (or top) of the screen and just use the rest of the screen for my app, moving in and out of activities while the banner stays put.

For this using fragment can help and other way is including View in different activity layout. But you will have to manage in all activities.

Simply it needs to be treated like a View as we use other.

0
Gordons On

On way is to use one Activity and then Fragments. Instead of moving from one Activity to the other, you will be attaching and detaching Fragments at the click of items. So your Banner Ad view will sit at the top or bottom of the Fragment View.

Check this old example on working with Fragments, it will help you