How can I re-upload after I close the Admob 2021 interstitial?

I'm switching to the new Admob 2021 interstitials. New InterstitialAd My main event has 10 episodes and no matter which one I switch to, an interstitial ad will appear. However, when I got back to the event, I noticed that it wasn't showing again. What I want to do is reload after closing the interstitial ad.

public class MainActivity extends Activity {

private InterstitialAd mInterstitialAd;

@Override
protected void onCreate(Bundle savedInstanceState) {
  super.onCreate(savedInstanceState);
  setContentView(R.layout.activity_main);

  MobileAds.initialize(this, new OnInitializationCompleteListener() {
    @Override
    public void onInitializationComplete(InitializationStatus initializationStatus) {}
  });
  AdRequest adRequest = new AdRequest.Builder().build();

  InterstitialAd.load(this,"ca-app-pub-3940256099942544/1033173712", adRequest, new InterstitialAdLoadCallback() {
  @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;
  }
});

} }



Read more here: https://stackoverflow.com/questions/66334902/how-can-i-re-upload-after-i-close-the-admob-2021-interstitial

Content Attribution

This content was originally published by serif at Recent Questions - Stack Overflow, and is syndicated here via their RSS feed. You can read the original post over there.

%d bloggers like this: