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