Adding AdMob interstitial ads before closing the app
<p>I want to display AdMob interstitial ad on exit link from the nav bar and close the app on click of either on the interstitial ad or the close button of the ad.</p>

<p>I am using the following codes but it won't work:</p>

<pre><code>InterstitialAd mInterstitialAd;
    void loadAdsFullScreen(){
        mInterstitialAd = new InterstitialAd(this);
        mInterstitialAd.setAdUnitId(getString(R.string.interstitial_ad));
        AdRequest request = new AdRequest.Builder()
                .tagForChildDirectedTreatment(true)
                .build();
        // Load ads into Interstitial Ads
        mInterstitialAd.loadAd(request);

        mInterstitialAd.setAdListener(new AdListener() {
            public void onAdLoaded() {
                showInterstitial1();
            }
        });
    }
</code></pre>

<p>The code I am using for closing the app and showing the ads is:</p>

<pre><code>else if (id == R.id.nav_exit) {

            mInterstitialAd = new InterstitialAd(this);
            mInterstitialAd.setAdUnitId(getString(R.string.interstitial_ad));
            AdRequest request = new AdRequest.Builder()
                    .tagForChildDirectedTreatment(true)
                    .build();
            // Load ads into Interstitial Ads
            mInterstitialAd.loadAd(request);

            mInterstitialAd.setAdListener(new AdListener() {
                public void onAdLoaded() {
                    showInterstitial();
                    finish();
                }
            });

            Test1.this.finish();
            System.exit(0);

        }
</code></pre>