0
votes

I'm having some problems with the admob adaptative banner. I implemented they like described on the docs, in a view in the bottom of the screen. What happens is that some users (a considerable number) are complaining about the ads covering the app's content. When they send me screenshots, I realized that the banner is expanding, like on the pic above:

enter image description here

The ads is going up because their height is really big. I can't reproduce that error on my phone, so I don't know what is going on. If somebody has some clue about what can be happening, please help me.

The ad load code:

private AdSize getAdSize() {
        // Step 2 - Determine the screen width (less decorations) to use for the ad width.
        Display display = getWindowManager().getDefaultDisplay();
        DisplayMetrics outMetrics = new DisplayMetrics();
        display.getMetrics(outMetrics);

        float widthPixels = outMetrics.widthPixels;
        float density = outMetrics.density;

        int adWidth = (int) (widthPixels / density);

        // Step 3 - Get adaptive ad size and return for setting on the ad view.
        return AdSize.getPortraitAnchoredAdaptiveBannerAdSize(this, adWidth);
    }

    private void loadBanner() {
        // Create an ad request. Check your logcat output for the hashed device ID
        // to get test ads on a physical device, e.g.,
        // "Use AdRequest.Builder.addTestDevice("ABCDE0123") to get test ads on this
        // device."
        AdRequest adRequest =
                new AdRequest.Builder().addTestDevice("E71EFAD8B03F3AE886BC0776F0AC0F09")
                        .addTestDevice(AdRequest.DEVICE_ID_EMULATOR)
                        .build();

        AdSize adSize = getAdSize();
        // Step 4 - Set the adaptive ad size on the ad view.
        adView.setAdSize(adSize);


        // Step 5 - Start loading the ad in the background.
        adView.loadAd(adRequest);
    }

and the view where they are shown:

<RelativeLayout
        android:id="@+id/adView"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_centerHorizontal="true"
        android:layout_alignParentBottom="true">
    </RelativeLayout>