0

I am writing an Android game and will be implementing Admob ads. My question is this - can I write code to switch an Admob ad off after it has been loaded, or do I have to have multiple activities in the app and attach the ad to one of these? (it would be much simpler to just have 1 activity in this particular app)

If I cannot shut it off, is there any necessary shut-down operation I should be performing when traversing from the activity with the ad to another activity, in order to ensure that the 2nd activity does not show an ad?

Note;

https://developers.google.com/admob/android/quick-start https://developers.google.com/admob/android/ad-events

Super Hacker
  • 124
  • 2
  • 3
  • 10

2 Answers2

0

If you have several view in which you expect the user to spend enough time for ads to be worthwhile then you are nest off having them in a single Activity that uses Fragments to switch the views.

That way you can keep your AdView either in the Activity itself or in a Fragment that does does change.

William
  • 20,150
  • 8
  • 49
  • 91
0

I ended up solving my app issues without solving this problem - it turned out that the reason my app was crashing when it traversed menus was that I had forgotten to set 0 as the minimum time for the app to sleep between frames, which caused an IllegalArgumentException (I didn't pick this up earlier as I was having difficulties with logcat). Of course, feel free to post any information for those who are interested.

Super Hacker
  • 124
  • 2
  • 3
  • 10