googleads-mobile-android-examples icon indicating copy to clipboard operation
googleads-mobile-android-examples copied to clipboard

edgetoedge full screen ad issue

Open FunkyMuse opened this issue 11 months ago • 5 comments
trafficstars

when showing a full screen ads, there's an issue with the ad, it's cut out for devices that have the cut out

FunkyMuse avatar Dec 15 '24 15:12 FunkyMuse

Use it like this and this problem will be solved......

if (Build.VERSION.SDK_INT>=Build.VERSION_CODES.VANILLA_ICE_CREAM){ EdgeToEdge.enable(this); } setContentView(R.layout.activity_main);

        if (Build.VERSION.SDK_INT>=Build.VERSION_CODES.VANILLA_ICE_CREAM) {
            ViewCompat.setOnApplyWindowInsetsListener(findViewById(R.id.main), (v, insets) -> {
                Insets systemBars = insets.getInsets(WindowInsetsCompat.Type.systemBars());
                v.setPadding(systemBars.left, systemBars.top, systemBars.right, systemBars.bottom);
                return insets;
            });
        }

Md-Kajol-Ali avatar Dec 20 '24 05:12 Md-Kajol-Ali

Use it like this and this problem will be solved......

if (Build.VERSION.SDK_INT>=Build.VERSION_CODES.VANILLA_ICE_CREAM){ EdgeToEdge.enable(this); } setContentView(R.layout.activity_main);

        if (Build.VERSION.SDK_INT>=Build.VERSION_CODES.VANILLA_ICE_CREAM) {
            ViewCompat.setOnApplyWindowInsetsListener(findViewById(R.id.main), (v, insets) -> {
                Insets systemBars = insets.getInsets(WindowInsetsCompat.Type.systemBars());
                v.setPadding(systemBars.left, systemBars.top, systemBars.right, systemBars.bottom);
                return insets;
            });
        }

The app is only Compose code :/

FunkyMuse avatar Dec 20 '24 07:12 FunkyMuse

Reported here about all full-screen-ads and ads-inspector, and also a workaround:

https://www.reddit.com/r/androiddev/comments/1hlctq1/google_pushes_for_edgetoedge_on_android_15_but/

AndroidDeveloperLB avatar Dec 25 '24 00:12 AndroidDeveloperLB

setOnApplyWindowInsetsListener applies to the current activity that we are using.

Your suggestion is good, but the ad visual is a separate activity that overlays the app's activities.

<activity
   android:name="com.google.android.gms.ads.AdActivity"
    android:theme="@android:style/Theme.Translucent" />

By default, this screen is used, but its theme cannot be changed from the manifest. We have already tried this method.

rohitraj-khorwal avatar Jan 29 '25 10:01 rohitraj-khorwal

@rohitraj-khorwal But I've reproduced it and it's different when using the workaround I've suggested.

Perhaps you are using more ad-sources for Admob mediation, and then you don't notice it. If so, you can add it to the Activities that they use, and then it's even a larger workaround...

For example, I've collected these (but I don't use them for now, as it's too many):

<activity
    android:name="com.applovin.adview.AppLovinFullscreenActivity"
    android:theme="@style/AdInspectorActivityTheme" tools:replace="android:theme" />

<activity
    android:name="com.chartboost.sdk.view.CBImpressionActivity" android:exported="false"
    android:theme="@style/AdInspectorActivityTheme" tools:replace="android:theme" />

<activity
    android:name="com.chartboost.sdk.internal.clickthrough.EmbeddedBrowserActivity"
    android:exported="false" android:theme="@style/AdInspectorActivityTheme"
    tools:replace="android:theme" />

<activity
    android:name="com.inmobi.ads.rendering.InMobiAdActivity" android:exported="false"
    android:theme="@style/AdInspectorActivityTheme" tools:replace="android:theme" />

<activity
    android:name="com.ironsource.sdk.controller.ControllerActivity" android:exported="false"
    android:theme="@style/AdInspectorActivityTheme" tools:replace="android:theme" />
<activity
    android:name="com.ironsource.sdk.controller.InterstitialActivity"
    android:exported="false" android:theme="@style/AdInspectorActivityTheme"
    tools:replace="android:theme" />
<activity
    android:name="com.ironsource.sdk.controller.OpenUrlActivity" android:exported="false"
    android:theme="@style/AdInspectorActivityTheme" tools:replace="android:theme" />
<activity
    android:name="com.ironsource.mediationsdk.testSuite.TestSuiteActivity"
    android:exported="false" android:theme="@style/AdInspectorActivityTheme"
    tools:replace="android:theme" />

<activity
    android:name="com.vungle.ads.internal.ui.VungleActivity" android:exported="false"
    android:theme="@style/AdInspectorActivityTheme" tools:replace="android:theme" />

<activity
    android:name="com.mbridge.msdk.activity.MBCommonActivity" android:exported="false"
    android:theme="@style/AdInspectorActivityTheme" tools:replace="android:theme" />

<activity
    android:name="com.mbridge.msdk.reward.player.MBRewardVideoActivity"
    android:exported="false" android:theme="@style/AdInspectorActivityTheme"
    tools:replace="android:theme" />

<activity
    android:name="com.mbridge.msdk.newreward.player.MBRewardVideoActivity"
    android:exported="false" android:theme="@style/AdInspectorActivityTheme"
    tools:replace="android:theme" />
<activity
    android:name="com.mbridge.msdk.out.LoadingActivity" android:exported="false"
    android:theme="@style/AdInspectorActivityTheme" tools:replace="android:theme" />

AndroidDeveloperLB avatar Jan 29 '25 10:01 AndroidDeveloperLB