请帮忙。插页式广告仅显示一次。我希望它能显示更多。

private void loadAds() {
    AdRequest adRequest = new AdRequest.Builder().build();
    mAdView.loadAd(adRequest);
    interstitial = new InterstitialAd(this);
    AdRequest adRequest2 = new AdRequest.Builder().build(); //
    interstitial.setAdUnitId(getResources().getString(R.string.admob_interstitial));
    interstitial.setAdListener(new AdListener() {

        @Override
        public void onAdLoaded() {
            AdLoaded = true;
        }

        @Override
        public void onAdClosed() {
            super.onAdClosed();
        }

        @Override
        public void onAdFailedToLoad(int errorCode) {
            AdLoaded = true;
        }
    });

    interstitial.loadAd(adRequest2);
}

public void displayInterstitial() {
    if (adsCounter == 0) {
        if (interstitial.isLoaded()) {
            interstitial.show();
        }
        adsCounter = 0;
    } else {
        adsCounter += 2;
    }
}

最佳答案

与此相关的OnAdClosed()

    @Override
          public void onAdClosed ()
          {
              AdRequest adRequest = new AdRequest.Builder()
                .build();
              interstitial.loadAd(adRequest);
          }

关于android - 多次展示插页式广告,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/34522085/

10-10 06:57