我有3个活动A,B和C,并且在活动B中显示插页式广告。但是问题是,如果我立即返回活动A,则插页式广告出现在活动A中。如果我立即转到下一个活动C,则插页式广告出现在活动C中显示。但我希望插页式广告仅在活动B中显示。因此,Google不接受我的应用更新。
答案 0 :(得分:0)
尝试这种方式
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();
}