我有一個活動來顯示全屏圖像。有一個按鈕可以下載圖像。在下載之前,我需要展示插頁式廣告。下載後,我需要請求&加載新的插頁式廣告。我已經編寫相同如下:如何在Android中請求新的插頁式廣告
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給我同樣的廣告呢?