为什么 Admob Interstitial Ad 不显示在 AndroidOS 上?

Why Is Admob Interstitial Ad Not Showing On AndroidOS?

我完全按照 Google 发布的方式应用了广告代码,但广告没有显示。

我的代码:

AdRequest adRequest = new AdRequest.Builder().build();
InterstitialAd.load( this, "ca-app-pub-3940256099942544/1033173712", adRequest, new InterstitialAdLoadCallback() { //test reklam id
    @Override
    public void onAdLoaded(@NonNull InterstitialAd interstitialAd) {
        // The mInterstitialAd reference will be null until
        // an ad is loaded.
        mInterstitialAd = interstitialAd;
        Log.i( TAG, "onAdLoaded" );
    }

    @Override
    public void onAdFailedToLoad(@NonNull LoadAdError loadAdError) {
        // Handle the error
        Log.i( TAG, loadAdError.getMessage() );
        mInterstitialAd = null;
    }
});

这是我用来显示广告的按钮代码:

btnGo.setOnClickListener( new View.OnClickListener() {
    @Override
    public void onClick(View v) {
        if (mInterstitialAd != null) {
            mInterstitialAd.show(MainActivity.this);
            Log.e( "ads", "must be shown" );
        }
        startActivity( new Intent( MainActivity.this, SecondActivity.class ) );
    }
});

加载广告时,我得到了有关它的加载日志,似乎没有问题。 我检查广告是否为 null 以显示广告状态,如果它不为 null,我会看到一个广告,这很好。 唯一的问题是广告没有展示。

可能是什么问题或我做错了什么?

问题已解决:

if (mInterstitialAd != null) {
    mInterstitialAd.show(MainActivity.this);
    mInterstitialAd.setFullScreenContentCallback(new FullScreenContentCallback(){
      @Override
      public void onAdDismissedFullScreenContent() {
        // Called when fullscreen content is dismissed.
    startActivity( new Intent( MainActivity.this, SecondActivity.class ) );
        Log.d("TAG", "The ad was dismissed.");
      }

      @Override
      public void onAdFailedToShowFullScreenContent(AdError adError) {
        // Called when fullscreen content failed to show.
    startActivity( new Intent( MainActivity.this, SecondActivity.class ) );
        Log.d("TAG", "The ad failed to show.");
      }

      @Override
      public void onAdShowedFullScreenContent() {
        // Called when fullscreen content is shown.
        // Make sure to set your reference to null so you don't
        // show it a second time.
        mInterstitialAd = null;
        Log.d("TAG", "The ad was shown.");
      }
    });
} else {
    startActivity( new Intent( MainActivity.this, SecondActivity.class ) );
                }