How to make fullscreen with code on android ? (for FullScreen Immersive Button not supported phones)

You can’t modify those files directly since they are modified each time you build your game. You need to use a combination of ubt and apl. In your game.build.cs you need to add apl file like this:

        if (Target.Platform == UnrealTargetPlatform.Android)
        {
            PrivateDependencyModuleNames.AddRange(new string[] { "Launch" });
            AdditionalPropertiesForReceipt.Add("AndroidPlugin", Path.Combine(ModuleDirectory, "YourName_APL.xml"));
        }

create an file with that name and apl extension and make it look like this:

<?xml version="1.0" encoding="utf-8"?>
<root xmlns:android="http://schemas.android.com/apk/res/android"
  package="com.YourCompany.YourPackage">

	<init>
		<log text="APLr init"/>
	</init>
<gameActivityOnCreateAdditions>
     <insert>
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
                 WindowManager.LayoutParams.FLAG_FULLSCREEN);
     </insert>
   </gameActivityOnCreateAdditions>

This way this code will be always inserted into GameActivity.java in OnCreate() method.

1 Like