private void requestNewInterstitial(int max) {
if (!adIsLoading && mInterstitialAd == null) {
adIsLoading = true;
AdRequest adRequest = new AdRequest.Builder().build();
InterstitialAd.load(FirstActivity.this, getString(R.string.inter)),
adRequest, new InterstitialAdLoadCallback() {
@Override
public void onAdLoaded(@NonNull InterstitialAd interstitialAd) {
mInterstitialAd = interstitialAd;
adIsLoading = false;
mInterstitialAd.setFullScreenContentCallback(new FullScreenContentCallback() {
@Override
public void onAdDismissedFullScreenContent() {
mInterstitialAd = null;
requestNewInterstitial(5);
Intent intent = new Intent(getApplicationContext(), SecondActivity.class);
startActivity(intent);
}
@Override
public void onAdFailedToShowFullScreenContent(@NonNull AdError adError) {
mInterstitialAd = null;
}
});
}
@Override
public void onAdFailedToLoad(@NonNull LoadAdError loadAdError) {
mInterstitialAd = null;
adIsLoading = false;
if (maxretry > 0) {
requestNewInterstitial(maxretry - 1);
}
}
});
}
else{
mInterstitialAd = null;
}
}
字符串
你可以看到在onAdDismissedFullScreenContent()方法中,我在代码行中再次请求一个新的填隙式:requestNewInterstitial(5);
。它似乎工作,但我想知道这是否完全没问题,或者这违反了任何admob规则,或者类似的东西?提前谢谢你
1条答案
按热度按时间wj8zmpe11#
是的,这是确定的,但不要显示第二个广告后,第一个立即,而是显示它后,另一个行动。