我有一个显示全屏图像的活动。有一个下载图像的按钮。在下载之前,我需要展示一个插页式广告。下载后,我需要请求并加载新的插页式广告。我的编码与以下相同:
public class FullScreenViewActivity extends Activity implements OnClickListener {
private InterstitialAd interstitial;
private AdRequest adRequest;
....
@Override
protected void onCreate(Bundle savedInstanceState) {
interstitial = new InterstitialAd(FullScreenViewActivity.this);
interstitial.setAdUnitId(getString(R.string.admob_interstitial_id)); //live ad unit
...
}
protected void onResume() {
super.onResume();
adRequest = getInterstitialAdRequest();
interstitial.loadAd(adRequest);
interstitial.setAdListener(new AdListener() {
public void onAdClosed() {
downloadImage();
adRequest = getInterstitialAdRequest();
interstitial.loadAd(adRequest);
}
public void onAdFailedToLoad(int var1) {
downloadImage();
adRequest = getInterstitialAdRequest();
interstitial.loadAd(adRequest);
}
public void onAdLeftApplication() {
downloadImage();
adRequest = getInterstitialAdRequest();
interstitial.loadAd(adRequest);
}
});
}
public AdRequest getInterstitialAdRequest() {
return new AdRequest.Builder().build();
}
}
我的问题是每次单击下载按钮时我都会看到相同的广告。我的逻辑有问题吗?还是每次我请求时,admob 都会给我相同的广告?