Android - Hiding navigation bar on 18:9 aspect ratio?

Hello everyone.

I need help with testing / running games on my Motorola Moto G6 Plus and presumably other 18:9 devices. While running there is a visible black bar in navigation bar area which overlaps content and making it impossible to play. I have created test level to show what I mean (screenshots attached below). GameActivity.java that is used, can be found HERE.

Android Minimum Version: API 9
Android Target Version: API 19

Phone is running Android 8.0 in 1080x2160 (18:9) resolution.

I have also tested the same game on other devices such as:
¤Motorola Moto G4 - Android 7.0 - 1080x1920 (16:9)
¤Motorola Moto G - Android 5.1.1 - 720x1280 (16:9)
¤Sony Ericsson Live with Walkman - Android 4.0.4 - 320x480 (3:2)

It is working fine on these devices.

Is there any way to fix this to show the whole screen (immersive mode)? If not, is there any way to force the game to run in 16:9 mode with black bars on each side?

What I want: Image 1
What I get: Image 2

I will gladly provide more information if needed.

Thanks!

Did you set a hard-coded width/height in your project.xml? If so, try removing it.

Do you listen to stage.addEventListener (Event.RESIZE, onResize); and handle it accordingly? Do any events come through?

Hello!

Sorry for late reply. I didn’t change anyting inside project.xml and I’m not sure how to listen to that event as I’m using Stencyl for creating games. I only know that it is based on OpenFL and using haxe language.

After trying many different things, I’m not sure what to do. I have freshly installed Stencyl on VM and run the game with included GameActivity.java (LINK) file with results like these:
https://imgur.com/a/lQw1y46

–>

With applying newer GameActivity.java (LINK), the results have changed to this:
https://imgur.com/a/lD7RZwu

As seen from the pictures, the only good result was with the new GameActivity.java on Moto G4. I wish to get the same result on my Moto G6 Plus.

From these differences, my guess is that I need to change something inside GameActivity.java file, but I have no idea what.

Thanks!

Can you try an OpenFL sample, such as openfl create PiratePig && cd PiratePig && openfl test android, to see if it behaves the same way, or any differently?

It turned out that I was missing <meta-data android:name="android.max_aspect" android:value="2.1" /> inside AndroidManifest.xml.

Thank you anyway!

1 Like