Setting androidSystemUiVisibility to immersiveSticky causes actual content values to clip to safe areas

There seem to be a bug in the behavior of:

native.setProperty( "androidSystemUiVisibility", "immersiveSticky" ) 

When I do not use this method (at start of my main) my code correctly stretches a background image to cover the entire screen size including the areas outside the safe zones. However, if I do use this method, the background image receives wrong values for the screen area (probably just the safe screen area instead of the full one).

The expected behavior is that display.actualContentWidth and display.actualContentHeight remains the same.

just guessing, but you may be trying to use those values “too soon” (before immersive actually kicks in)

immersive will resize the available screen, thus changing those values (assuming letterbox scaling)

sounds like you want the “after immersive” values, so you may need to listen for resize events

Hi @davebollinger,

You are right of course :slight_smile: should have thought about it myself.

Did some tests and seems we need to listen to the resize event due to several cases, such as suspend/resume events that cause the bar to reappear. Ended up with something like this to support immersive option on android:

local isAndroid = "Android" == system.getInfo("platformName") if isAndroid then native.setProperty( "androidSystemUiVisibility", "immersiveSticky" ) end display.setStatusBar( display.HiddenStatusBar ) local function onResize( event ) if isAndroid and native.getProperty( "androidSystemUiVisibility" ) ~= "immersiveSticky" then native.setProperty( "androidSystemUiVisibility", "immersiveSticky" ) end updateSizes() --update all game internal size values end Runtime:addEventListener( "resize", onResize )

Perhaps something like this should be in the method documentation.

just guessing, but you may be trying to use those values “too soon” (before immersive actually kicks in)

immersive will resize the available screen, thus changing those values (assuming letterbox scaling)

sounds like you want the “after immersive” values, so you may need to listen for resize events

Hi @davebollinger,

You are right of course :slight_smile: should have thought about it myself.

Did some tests and seems we need to listen to the resize event due to several cases, such as suspend/resume events that cause the bar to reappear. Ended up with something like this to support immersive option on android:

local isAndroid = "Android" == system.getInfo("platformName") if isAndroid then native.setProperty( "androidSystemUiVisibility", "immersiveSticky" ) end display.setStatusBar( display.HiddenStatusBar ) local function onResize( event ) if isAndroid and native.getProperty( "androidSystemUiVisibility" ) ~= "immersiveSticky" then native.setProperty( "androidSystemUiVisibility", "immersiveSticky" ) end updateSizes() --update all game internal size values end Runtime:addEventListener( "resize", onResize )

Perhaps something like this should be in the method documentation.