Skip to content Skip to sidebar Skip to footer

Is There A Way To 'cancel' Or Stop An Interstital Ad If The App Is Not In Foreground?

I have an interstitial ad implemented in my app. This ad is shown when a user performs a certain task. Now this task is on the main screen of my app, so the user just performs the

Solution 1:

I suspect that your problem is that that are calling interstitial.show() from onAdLoaded() of your AdListener. Do NOT do this. It provides a poor user expereince and will get your account banned.

Instead you should call interstitial.show() from a natural break point in your app.

Solution 2:

uhmm i think this falls on workarounds, so what i am thinking, hope you know how to check if your app is showing or not using the lifecycle methods.. so suppose my boolean is

staticbooleanshowing=false; 

then on my interestial ad i add a listener

interstitial.setAdListener(new AdListener() {

                @Override
                public void onAdClosed() {
                    // TODO Auto-generated method stub
                    super.onAdClosed();
                }

                @Override
                public void onAdLoaded() {
                    // TODO Auto-generated method stub
                    super.onAdLoaded();
                    if(Myclassname.showing){// check if your app is showing                    
                    interstitial.show();
                    }
                }

                @Override
                public void onAdOpened() {
                    // TODO Auto-generated method stub
                    super.onAdOpened();
                }
            });

hope its good

Post a Comment for "Is There A Way To 'cancel' Or Stop An Interstital Ad If The App Is Not In Foreground?"