kerollos
kerollos

Reputation: 87

How to check for previous interstitial ad whether still shown or not?

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

Answers (1)

Ravinder Bhandari
Ravinder Bhandari

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

Related Questions