Need advice on making Android game fullscreen

Hi all,

I’m currently developing an Android game and I’m having some trouble getting it to display in fullscreen mode on certain devices. I’ve tried enabling the “Use Display Cutout Region” option, but there’s still a blank space in the notch bar on some devices.

Device: Oneplus nord 2

After doing some research, I found some code in the Splash activity provided by Unreal Engine that seems to be blocking fullscreen mode on certain devices:

SplashActivity.java: After Line: 98

// allow certain models for now to use full area around cutout
boolean BlockDisplayCutout = true;
if (android.os.Build.MANUFACTURER.equals("HUAWEI"))
{
    BlockDisplayCutout = false;
}
else if (android.os.Build.MANUFACTURER.equals("HMD Global"))
{
    String model = android.os.Build.MODEL;
    if (model.equals("Nokia 8.1"))
    {
        BlockDisplayCutout = false;
    }
}
else if (android.os.Build.MANUFACTURER.equals("samsung"))
{
    String model = android.os.Build.MODEL;
    if (model.startsWith("SM-G970") || model.startsWith("SM-G973") || model.startsWith("SM-G975") ||
        model.startsWith("SC-03L") || model.startsWith("SCV41") || model.startsWith("SC-04L") ||
        model.startsWith("SCV42") || model.startsWith("SM-N97") || model.startsWith("SM-F700") ||
        model.startsWith("SM-G98") || model.startsWith("SCV47") || model.startsWith("SCG01") ||
        model.startsWith("SCG02") || model.startsWith("SC-51A") || model.startsWith("SC-52A") ||
        android.os.Build.VERSION.SDK_INT >= 28)
    {
        BlockDisplayCutout = false;
    }
}
else if (android.os.Build.MANUFACTURER.equals("Xiaomi"))
{
    String model = android.os.Build.MODEL;
    if (model.startsWith("POCOPHONE F1"))
    {
        BlockDisplayCutout = false;
    }
}
else if (android.os.Build.MANUFACTURER.equals("OnePlus"))
{
    String model = android.os.Build.MODEL;
    if (model.startsWith("IN2020") || model.startsWith("IN2021") || model.startsWith("IN2023") ||
        model.startsWith("IN2025") || model.startsWith("IN2010") || model.startsWith("IN2011") ||
        model.startsWith("IN2013") || model.startsWith("IN2015") || model.startsWith("IN2017") ||
        model.startsWith("IN2019") || model.startsWith("AC2001") || model.startsWith("AC2003") ||
        model.startsWith("BE2025") || model.startsWith("BE2026") || model.startsWith("BE2028") ||
        model.startsWith("BE2029"))
    {
        BlockDisplayCutout = false;
    }
}
if (BlockDisplayCutout)
{
    UseDisplayCutout = false;
}

and:

if (UseDisplayCutout)
{
    // only do this on Android Pie and above
    if (android.os.Build.VERSION.SDK_INT >= 28)
    {
        WindowManager.LayoutParams params = getWindow().getAttributes();
        params.layoutInDisplayCutoutMode = WindowManager.LayoutParams.LAYOUT_IN_DISPLAY_CUTOUT_MODE_SHORT_EDGES;
        getWindow().setAttributes(params);
    }
    else
    {
        UseDisplayCutout = false;
    }
}

What if I remove the first code? Will this affect any kind of crash on those devices?
But I tried to remove the code and tested and it worked perfectly.

Any advice would be greatly appreciated. Thanks!

Hey did you manage to solve this problem?

My app works fullscreen only if splash screen is disabled. I deleted the first code in your post from …\UnrealEngine-4.27-plus\Engine\Build\Android\Java\src\com\epicgames\ue4\SplashActivity.java but there’s no effect

Change the “Maximum supported aspect ratio” value from 2.1 to 2.4