我制作了一个网络视图应用。我定期添加了插页式广告。假设在 120秒之后。当我关闭插页式广告时,它将带我回到主页。假设我正在浏览关于页面。关闭广告后,我回到首页。但我想留在ABOUT页面中。
主要活动。Java
private InterstitialAd mInterstitialAd;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
prepareAd();
ScheduledExecutorService scheduler = Executors.newSingleThreadScheduledExecutor();
scheduler.scheduleAtFixedRate(new Runnable() {
public void run() {
Log.i("Sample", "CV");
runOnUiThread(new Runnable() {
public void run() {
if (mInterstitialAd.isLoaded()) {
mInterstitialAd.show();
} else {
Log.d("TAG", " Interstitial not loaded");
}
prepareAd();
}
});
}
}, 20, 40, TimeUnit.SECONDS);
}
public void prepareAd() {