Screen is damaged when trying to use banner and interstitial ads in the same app

I am trying to display banner ads and interstitials using admob on different screens of my application. But every time I switch from an activity showing an interstitial ad to an activity showing a banner ad, my screen gets corrupted. It works great when I only use one of the two.

Sounds like admob question. Does anyone know of any work?

Refresh - Banner ad

<com.google.android.gms.ads.AdView
        android:id="@+id/adView"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_alignParentBottom="true"
        ads:adSize="SMART_BANNER"
        ads:adUnitId="@string/ad_unit_id"
        android:visibility="visible" />

public void onCreate(Bundle instance){
...
   mAdView = (AdView) findViewById(R.id.adView);
   mAdView.loadAd(new AdRequest.Builder().build());
...
}

      

Interstitial ad

 public void onCreate(Bundle instance){
   ...
   interstitialAd = new InterstitialAd(this);
       interstitialAd.setAdUnitId(getResources().getString(R.string.full_screen_ad_unit_id));
       interstitialAd.setAdListener(new AdListener() {
                @Override
                public void onAdClosed() {
                    finish();
                }
            });
       requestNewInterstitial();
    }

    private void requestNewInterstitial() {
        AdRequest adRequest = new AdRequest.Builder().build();

        interstitialAd.loadAd(adRequest);
    }

    public void showAd() {
        if (interstitialAd.isLoaded()) {
            interstitialAd.show();
        } else {
            finish();
        }

    }

      

screenshot from device

+3


source to share





All Articles