我正在使安卓应用程序与AdMob集成在我的应用程序中,我使用AdMob来显示广告后20秒的WebView加载。问题是,当用户在20秒内关闭应用程序时,间隙广告仍然显示,这违反了谷歌AdMob的政策,我如何才能使用户退出活动或应用程序时,间隙广告不应显示
这是我的代码:
new Handler().postDelayed(new Runnable() {
@Override
public void run() {
interAd = new InterstitialAd(MainActivity.this);
interAd.setAdUnitId("ca-app-pub-3940256099942544/1033173712");
AdRequest adRequest = new AdRequest.Builder()
.addTestDevice("SEE_YOUR_LOGCAT_TO_GET_YOUR_DEVICE_ID")
.build();
interAd.loadAd(adRequest);
interAd.setAdListener(new AdListener() {
@Override
public void onAdLoaded() {
interAd.show();
}
});
interAd.setAdListener(new AdListener() {
@Override
public void onAdClosed() {
// Code to be executed when the interstitial ad is closed.
Log.i("Ads", "onAdClosed");
}
});
}
} , 20000);
https://stackoverflow.com/questions/46382451
复制相似问题