Shin-NiL / Godot-Android-Admob-Plugin

Android AdMob plugin for Godot Game Engine 3.2 or higher
MIT License
543 stars 66 forks source link

Ads are not shown in full screen. #224

Closed HanouaJ closed 1 year ago

HanouaJ commented 1 year ago

Godot version: 3.5.2

AdMob Plugin version: 6.2.0

Issue description:

The ads (either rewarded video ads or interstitial) are not showing full screen (as shown in the screenshot), the ads however gets full screen when I put my game in the background and then put it back to the foreground immediately while the ad is playing. Having this issue on a Realme 7 Pro with android 12 and 1080 x 2400 pixels resolution. The admob ads from different other applications show full screen in the same phone without problem.

Screenshot_2023-08-05-16-59-49-11_66f68e1b3cfb15f0eb390040021d8e6b

I tried the same scenario on an relatively old small resolution phone and I don't have this issue.

HanouaJ commented 1 year ago

It turns out my game was taking all the screen with the camera notch / screen Cutout included, while the ads doesn't take the camera cut out area.

What I did was limiting the game screen to not cover the camera notch, with putting into android/build/res/values/themes.xml :

<?xml version="1.0" encoding="utf-8"?>
<resources>

<style name="GodotAppMainTheme" parent="@android:style/Theme.Black.NoTitleBar.Fullscreen">
    <item name="android:windowLayoutInDisplayCutoutMode">never</item>
    <item name="android:windowTranslucentStatus">true</item>
    <item name="android:windowTranslucentNavigation">true</item>
</style>

<style name="GodotAppSplashTheme" parent="@style/GodotAppMainTheme">
    <item name="android:windowBackground">@drawable/splash_drawable</item>
    <item name="android:windowLayoutInDisplayCutoutMode">never</item>
    <item name="android:windowTranslucentStatus">true</item>
    <item name="android:windowTranslucentNavigation">true</item>
</style>

</resources>