Reputation: 87
I have three activities, I want to show interstitial ad in the second and third Activity
.
The user may open both Activity
after each other, the result will be two interstitial ads shown.
How to avoid this behaviour?
Upvotes: 1
Views: 1418
Reputation: 2636
You can refer this (updated link) link which shows how you can use adbmob ads listener to get callbacks depending upon the present state of an ad.
Use AdListener to receive such callbacks, here's a sample of how you can do this.
adView.setAdListener(new AdListener() {
@Override
public void onAdFailedToLoad(int errorCode) {
}
@Override
public void onAdClosed() {
}
@Override
public void onAdOpened() {
}
@Override
public void onAdLoaded(){
}
});
so, if an ad is already onscreen don't show another.
Upvotes: 1