A
A
Alexander2015-07-19 00:36:36
Android
Alexander, 2015-07-19 00:36:36

How to make the AdMob interstitial ad show only the first time an Activity is shown?

How to display AdMob interstitial ads only when first opening an Activity.
So that after the banner is closed, it is no longer displayed in this Activity. (until the next launch of the application)
Thank you very much in advance!

Answer the question

In order to leave comments, you need to log in

2 answer(s)
O
one pavel, 2015-07-19
@onepavel

Do you know what a boolean variable is?

I
IceJOKER, 2015-07-19
@IceJOKER

in onStart you open the declaration and switch the variable to true , and in onStop or onDestroy you change the value back to false
. Better yet, store the value in sharedPreferences as I described above, but instead of the sharedPreferences variable.
There is plenty of information on how to use both.
ps If I were you, I would not show an ad on the first launch, because Personally, I would remove such an application myself. Need to find a more competent way to show that was unobtrusive

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question