我只能让它显示一次,当我请求另一个广告或者只是尝试再次显示相同的广告时它不起作用..无论我做什么,它只显示一次。我试过了
我有这个onCreate
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
setSupportActionBar(toolbar);
mInterstitialAd = new InterstitialAd(this);
mInterstitialAd.setAdUnitId(getString(R.string.interstitial_ad_unit_id));
AdRequest adRequestInterstial = new AdRequest.Builder()
.addTestDevice("xxxxxxxxxxxxxxxxxxx")
.build();
mInterstitialAd.loadAd(adRequestInterstial);
然后我有召唤码
if(mInterstitialAd.isLoaded()){
mInterstitialAd.show();
requestNewInterstitial();
}
requestNewInterstitial代码:
private void requestNewInterstitial() {
AdRequest adRequest = new AdRequest.Builder()
.addTestDevice(AdRequest.DEVICE_ID_EMULATOR)
.addTestDevice("xxxxxxxxxxxxxxxxxxxxxxx")
.build();
mInterstitialAd.loadAd(adRequest);
}
谢谢。
答案 0 :(得分:0)
//listner for adClosed fixed the situation
mInterstitialAd.setAdListener(new AdListener() {
@Override
public void onAdClosed() {
AdRequest adRequest = new AdRequest.Builder()
.addTestDevice("xxxxxxxxxxxxxxxxxx")
.build();
mInterstitialAd.loadAd(adRequest);
}
});