Got message from Android Developer Support Team: "Freeze! 2" won't run on "upcoming releases of Android"

Hi Vlad, hi SGS,

I guess you couldn’t find any problems because the Google Team tested “Freeze! 2” against the Developer Preview of the upcoming Android 9.0 (Codename could be “Pie”, and they will give more info about this on March 14, because 3.14 = pi :slight_smile:  ).

With Android 8.x all was fine with the old code.

Best

Andreas

As I wrote on the other thread…

It should be:

if (system.getInfo("platform") == "Android")

instead of

if (system.getInfo("platformName") == "Android")

since platformName is deprecated.

Note that “platform” would return names in lower case.

So, actually it’s 

if system.getInfo("platform") == "android" then ... end

Cheers!

hey, I was just trying to add to the post, that navigation bar on Samsung Glxy S8 stays ON despite this code. Maybe this is the reason… 

Thanks, Vlad.

FWIW, 

system.getInfo("platformName")

still works.  The change to

system.getInfo("platform") == "android"

does add a complication in that it also returns true on sim so is not suitable for checking if on an actual device - for say ads initialisation.

@vlad, these values could be better exposed as properties, for example

if system.isAndroid then \<do something android\> elseif system.isIos then \<do something iOS\> elseif system.isSim then \<do something sim\> end

If I understand this correctly, this code is supposed to hide the navigation bar on devices with no physical buttons, correct?

I added the code on main.lua and it sort of works the first time but if I…

  1. go on the internet after that and I doubletap the dot on navigation bar so that navigation bar is always on

  2. close my app from previously active (opened) apps

  3. restart my app

the navigation bar is ON

is there something I should do differently or is this how it’s supposed to work?

If I open Mario Run for instance, the navigation bar always disappears.

@odisej you need to use the resize event

sorry Sphere - I believe I misunderstood earlier…I do use this code:

&nbsp;if( platform == "android" ) then local function onResize( event ) &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if (system.getInfo("androidApiLevel") \>= 19) then &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;native.setProperty("androidSystemUiVisibility", "immersiveSticky") &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;else &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;native.setProperty("androidSystemUiVisibility", "lowProfile") &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; end &nbsp; &nbsp;end &nbsp; &nbsp;Runtime:addEventListener( "resize", onResize ) &nbsp;end

You probably want to call the native.setProperty() functions in your main.lua outside of a resize event.  The resize event is to call code that will reshape your app’s display elements. For instance if you have buttons at the bottom of your screen where the nav bar was, when it hides, you might want to move those buttons down a few pixels to fill the space.  That would happen inside the resize event.

Rob

@Rob you are correct.  You must first do it main.lua but then also in resize()

This needs to be done in resize event too as that is fired after an ad is shown / browse internet to force the virtual bar to hide again.

I use this

local function onResize( event ) if \_isAndroid then if (system.getInfo("androidApiLevel") or 0) \>= 19 then native.setProperty("androidSystemUiVisibility", "immersiveSticky") else native.setProperty("androidSystemUiVisibility", "lowProfile") end end --recalculate our new screen constants \_originX, \_originY = display.screenOriginX, display.screenOriginY \_W, \_H = display.actualContentWidth, display.actualContentHeight \_centreX, \_centreY = \_W/2, \_H/2 --move the UI if isDisplayObject(uiTopButtons) then uiTopButtons.y = \_originY end if isDisplayObject(uiBottomButtons) then uiBottomButtons.y = \_originY + \_H - 30 end end

Thanks to both. Rob’s answer did the trick.

this was giving me an error:

if (system.getInfo("androidApiLevel") or 0) \>= 19 then

this is ok

if ((system.getInfo("androidApiLevel")) or 0) \>= 19 then

The first line is missing an opening (.

Rob