title: Cancel/Pause/Stop any Interstitial Ads
body: <p>I have an Android App which displays Interstitial Ads using Googles admob network. The good thing about admob is, its activity independent. I can load the ad in my MainActivity and whenever admob is ready with the ad, it will display it, even when I am not in MainActivity anymore. I already use the <code>isLoaded()</code> method to show the ad, and thats 90% of the time already working as desired.</p>
  
  <p>But the other 10% it is not. There are certain activities which should remain adfree because the ad will decrease the quality of the game. If a phone is slow or the connection is slow and it takes a while to load an ad, the ad might pop up in the wrong activity.</p>
  
  <p>Is there something I could call, which would close loaded ads and stops loading ads which are not displayed yet? This would take effect only on two activities whilst the others will remain as they are.</p>
  
  <p>so in my main activity I call:</p>
  
  <pre><code>Ads.loadAdMobInterstitial(MainActivity.this);
  </code></pre>
  
  <p>and this is my class which handles Ads:</p>
  
  <pre><code>public class Ads {
  
      public static InterstitialAd loadAdMobInterstitial(final Context context) {
  
              int admobUnitId = string.admob_ad_unit_id; 
  
              final InterstitialAd iAd = new InterstitialAd(context);
              iAd.setAdUnitId(context.getString(admobUnitId));
  
              iAd.setAdListener(new AdListener() {
                  @Override
                  public void onAdLoaded() {
                          iAd.show();
                  }
  
              });     
  
              AdRequest adRequest = new AdRequest.Builder()
              .addTestDevice(AdRequest.DEVICE_ID_EMULATOR)
              .build();
  
              iAd.loadAd(adRequest);
  
              return iAd;
          }
  }
  </code></pre>