Объявления SMART_BANNER не всегда загружаются в альбомной ориентации

Он работает нормально для портретной ориентации 100%, всегда вызывается onAdLoaded и появляется реклама

А вот в альбомной ориентации грузятся очень редко, обычно onAdFailedToLoad называется

Я имею в виду, какой смысл использовать SMART_BANNER, если он загружается очень редко в ландшафтном режиме?

Мой код (я всегда заново создаю AdView и запрашиваю новое объявление при изменении ориентации)

Манифест

android:configChanges="keyboard|keyboardHidden|orientation|screenSize|smallestScreenSize|screenLayout"

Макет активности XML

<?xml version="1.0" encoding="utf-8"?>
<android.support.constraint.ConstraintLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent">

    <FrameLayout
        android:id="@+id/adViewWrapper"
        android:visibility="gone"
        app:layout_constraintBottom_toBottomOf="parent"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintStart_toStartOf="parent"
        android:layout_width="0dp"
        android:layout_height="wrap_content">
    </FrameLayout>
    ...

Ява

private void setAd() { // I call it in onCreate
    mAdView = new AdView(this);
    mAdView.setAdSize(AdSize.SMART_BANNER);
    mAdView.setAdUnitId("...............");
    mAdView.setId(R.id.adView);
    FrameLayout.LayoutParams lp = new FrameLayout
            .LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT);
    mAdView.setLayoutParams(lp);
    ((FrameLayout) findViewById(R.id.adViewWrapper)).addView(mAdView);
    AdRequest adRequest = new AdRequest.Builder().build();
    mAdView.setAdListener(mBannerAdListener);
    mAdView.loadAd(adRequest);
}

@Override
public void onConfigurationChanged(final Configuration newConfig) {
    super.onConfigurationChanged(newConfig);
    // Checks the orientation of the screen
    Log.i(TAG, "onConfigurationChanged");
    if (mCurrentOrientation != newConfig.orientation) {
        mCurrentOrientation = newConfig.orientation;
        if (mAdView != null) {
            FrameLayout.LayoutParams lp = (FrameLayout.LayoutParams) mAdView.getLayoutParams();
            final FrameLayout parentLayout = (FrameLayout) mAdView.getParent();
            parentLayout.setVisibility(View.GONE);
            int adViewId = mAdView.getId();
            String adUnitId = mAdView.getAdUnitId();
            AdSize adSize = mAdView.getAdSize();
            mAdView.destroy();
            parentLayout.removeView(mAdView);

            mAdView = new AdView(this);
            mAdView.setAdSize(adSize);
            mAdView.setAdUnitId(adUnitId);
            mAdView.setId(adViewId);
            mAdView.setLayoutParams(lp);
            parentLayout.addView(mAdView);

            mAdView.setAdListener(mBannerAdListener);
            AdRequest adRequest = new AdRequest.Builder().build();
            mAdView.loadAd(adRequest);
        }
    }
}

private AdListener mBannerAdListener = new AdListener() {
    @Override
    public void onAdLoaded() {
        // Code to be executed when an ad finishes loading.
        Log.i(TAG, "AdListener onAdLoaded");
        findViewById(R.id.adViewWrapper).setVisibility(View.VISIBLE);
    }

    @Override
    public void onAdFailedToLoad(int errorCode) {
        Log.i(TAG, "AdListener onAdFailedToLoad");
        // Code to be executed when an ad request fails.
        findViewById(R.id.adViewWrapper).setVisibility(View.GONE);
    }

    @Override
    public void onAdOpened() {
        Log.i(TAG, "AdListener onAdOpened");
        // Code to be executed when an ad opens an overlay that
        // covers the screen.
    }

    @Override
    public void onAdLeftApplication() {
        Log.i(TAG, "AdListener onAdLeftApplication");
        // Code to be executed when the user has left the app.
    }

    @Override
    public void onAdClosed() {
        Log.i(TAG, "AdListener onAdClosed");
        // Code to be executed when when the user is about to return
        // to the app after tapping on an ad.
    }
};

person user25    schedule 15.07.2018    source источник