【发布时间】:2018-09-13 10:47:30
【问题描述】:
我有 3 个活动 A、B 和 C,我在活动 B 中展示插页式广告。但问题是,如果我立即返回活动 A,插页式广告会出现在活动 A 中。如果我立即进入下一个活动 C,插页式广告会出现在活动 C 中。但我希望插页式广告仅在活动 B 中显示。由于这个原因,Google 不接受我的应用更新。
【问题讨论】:
标签: android interstitial
我有 3 个活动 A、B 和 C,我在活动 B 中展示插页式广告。但问题是,如果我立即返回活动 A,插页式广告会出现在活动 A 中。如果我立即进入下一个活动 C,插页式广告会出现在活动 C 中。但我希望插页式广告仅在活动 B 中显示。由于这个原因,Google 不接受我的应用更新。
【问题讨论】:
标签: android interstitial
试试这个方法
InterstitialAd mInterstitial = new InterstitialAd(this);
mInterstitial.setAdUnitId(getResources().getString(Your_init_id));
AdRequest adRequest = new AdRequest.Builder().build();
mInterstitial.setAdListener(new AdListener() {
@Override
public void onAdLoaded() {
Log.d("==","onAdLoaded");
mInterstitial.show();
}
@Override
public void onAdFailedToLoad(int errorCode) {
// Code to be executed when an ad request fails.
Log.d("==","onAdFailedToLoad"+errorCode);
moveToOtherActivity();
}
@Override
public void onAdOpened() {
// Code to be executed when the ad is displayed.
}
@Override
public void onAdLeftApplication() {
// Code to be executed when the user has left the app.
}
@Override
public void onAdClosed() {
// Code to be executed when when the interstitial ad is closed.
Log.d("==","onAdClosed");
moveToOtherActivity();
}
});
mInterstitial.loadAd(adRequest);
}
private void moveToOtherActivity() {
Intent intent;
intent = new Intent(this,Activity_which_you_want_to_display_after_interstitial .class);
startActivity(intent);
finish();
}
【讨论】:
【讨论】: