Is there a way to 'cancel' or stop an Inte

2019-08-26 03:23发布

问题:

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 task and leaves the app. The problem is, sometimes the ad is shown after the user performs the task and leaves the app. Will this get me banned from play store? Also, my main question, is there a way to avoid this?

回答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.



回答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

static boolean showing = 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



标签: android admob