Full Screen Immersive Mode

When implementing immersiveSticky for Android devices with soft navigation buttons. there are always black bars at the top and the bottom of the screen, no matter what tricks I try (different config settings, onResize event etc). I have read everything I found and tried everything I could think of.

Has anybody succeded to achieve a 100% fullscreen immersive mode (without black bars), so far ?

Is this possible at all, with Corona?

Can you make tiny demo app we can download, build, and run on our own test devices?

This will help us give you some insights and hints on what to change.

Specifically, I’m asking for a project with these parts:

  • config.lua
  • build.settings
  • main.lua 
  • background image
  • some other images if it makes sense for your demo

You can use this as a starting point if you want:

https://github.com/roaminggamer/RG_FreeStuff/raw/master/AskEd/askEdStarter.zip

If you want, the easiest way to attach the project here is to:

  1. Make the project and zip it up (ZIP file)

  2. Click ‘More Reply Options’ button below.

  3. Attach as follows:

attaching_files.jpg

Also, what specific test devices have you tried?  I only have two now, so I have limited ability to try this:

  • Gen 1 Nexus 7 - On screen controls.
  • Galaxy Tab 4 - On bezel controls.

@roaminggamer

Thanks for your reply. I am going to attach a mini demo if this helps, but I think the issue is known back from 2015:

https://forums.coronalabs.com/topic/53170-immersivesticky-and-displayscreenoriginx/

My question is just whether anything has been changed till then. For example, with a scene that just shows a huge background, can you get 100% full-screen immersive (no black bars) on your Nexus 7?

The setting I am using is : native.setProperty( “androidSystemUiVisibility”, “immersiveSticky”)

@nugett,

I am recharging it now and will give this an examination.  I feel like I solved this for my own apps long ago and once I understood the source of the issue it wasn’t a problem anymore.

That said, I can’t remember the specifics now, so let me wait till I can give this a real test.

Cheers,

Ed

Wonderful! :slight_smile:

I’m really curious because no matter what I tried in config, it doesn’t seem to work…

@nugett,

I do believe the solution is active, not passive.

i.e You can’t just set some values and forget it.   You need to actively detect when the on-screen controls are shown and hidden, then adjust.

I’ll confirm or debunk this recollection when I can.

Yes, what I tried (among other) was to detect the resolution change with onResize event and change all the globals about the content areas etc. Then redraw the whole scene. But it didn’t work. So, I guessed it was a good idea to first ask whether others are indeed achieving this (100% fullscreen) or it is a Corona limitation…

So far, my Nexus is a brick.  I am still recharging with the hope it will wake up.

Till then, the best I can do is share my initial test:
 

https://github.com/roaminggamer/RG_FreeStuff/raw/master/AskEd/2018/05/fullScreenImmersive.zip

If I’m right, this should re-apply “immersive” when you are finished with the buttons, but I may have made a mistake.

I’ll know more if I ever get to test.

OK, that is not quite right.  

My device just woke up and this solution is not quite right.  Please hold a few.

This is starting to feel like a bug.

I’ve tried some things and I keep getting this black bar at the bottom that covers all content.  The aspect ratio is right, but Corona is simply covered.

I did notice, when using “immersiveSticky” I get these results:

  • swipe up shows back menu and top bar as translucent entities.  Aspect ratio of Corona content is unmodified
    • Waiting a moment causes bars to self-hide.  No negative visual effects
    • Clicking back button activates my back catcher and slides Corona content up.
      • Clicking NO hides bars and slides content back down.  No negative visual effects
    • Clicking ‘square’ button pops up list of running apps.
      • Re-selecting current app shows it again and hides bars.
      • I then get the black bar at the bottom

Updated code:

https://github.com/roaminggamer/RG_FreeStuff/raw/master/AskEd/2018/05/fullScreenImmersive.zip

This should work for all devices (it’s what I use)

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 = originX + \_W/2, \_originY +\_H/2 --move the UI if isDisplayObject(uiTopButtons) then uiTopButtons.y = \_originY end if isDisplayObject(uiBottomButtons) then uiBottomButtons.y = \_originY + \_H end end

@roaminggamer, your issue:  BBABFRFTLRI (black bar at bottom following resume from task list restoring immersive) has been a bug since day one of immersive:  https://forums.coronalabs.com/topic/53170-immersivesticky-and-displayscreenoriginx/

…but, I’m not sure that’s the OP’s issue.  having “black bars” at BOTH top and bottom sounds like just not properly responding to the resize event, and a letterbox setup with yAlign=“center”.  fe, something created to exactly fill the screen PRE-immersive, won’t fill the screen POST-immersive, unless you specifically do something to change it (or use zoomStretch) because screen dimensions (obviously?) CHANGE following immersive.  also, fwiw, yAlign=“top” can be slightly more intuitive to use when planning for immersive.

This is what I get with @roaminggamer’s github code on a LG G6 (soft navigation buttons, Android 7). Same black bars on top and bottom as with my (dozens) variations of code. Do you guys get a full screen immersive with the same code?

https://ibb.co/kiA7fd

@davebollinger

You are right. The problem is that the onResize() event seems to be never fired get in my code. I have also tried SGS’s version, with same results.

Are you sure onResize() is actually getting called?  Did you declare it as Runtime and put it into main.lua?

Next thing to try is to delay my code by a few seconds and see if it is a timing issue - screen metrics checking too fast and soft bar is still on screen.

All I can say is this works for me black bar free on everything from a tiny S3 to an S9 in max resolution. FWIW, I use xAlign and yAlign of center.

BTW, Ed’s code works fine for me.

Finally I found out that the issue I had was related to the mobile OS. Thanks for your help!

Just to return something to the community: I think that it is way better to separate the immersive setter from the onResize() listener.

The onResize event is triggered both after a resume event and after a set immersive command. So after a resume event you get 2 runs of onResize (this only happens on device, not on simulator, test it with some onscreen prints etc). So, I ended up abandoning the onResize and handling the immersion, resize check and redraw solely on the appstart and resume events. Now, on resume the scene doesn’t need to be redrawn at all, compared to 2 consecutive and redudant redraws when using the onResize.

Can you make tiny demo app we can download, build, and run on our own test devices?

This will help us give you some insights and hints on what to change.

Specifically, I’m asking for a project with these parts:

  • config.lua
  • build.settings
  • main.lua 
  • background image
  • some other images if it makes sense for your demo

You can use this as a starting point if you want:

https://github.com/roaminggamer/RG_FreeStuff/raw/master/AskEd/askEdStarter.zip

If you want, the easiest way to attach the project here is to:

  1. Make the project and zip it up (ZIP file)

  2. Click ‘More Reply Options’ button below.

  3. Attach as follows:

attaching_files.jpg

Also, what specific test devices have you tried?  I only have two now, so I have limited ability to try this:

  • Gen 1 Nexus 7 - On screen controls.
  • Galaxy Tab 4 - On bezel controls.

@roaminggamer

Thanks for your reply. I am going to attach a mini demo if this helps, but I think the issue is known back from 2015:

https://forums.coronalabs.com/topic/53170-immersivesticky-and-displayscreenoriginx/

My question is just whether anything has been changed till then. For example, with a scene that just shows a huge background, can you get 100% full-screen immersive (no black bars) on your Nexus 7?

The setting I am using is : native.setProperty( “androidSystemUiVisibility”, “immersiveSticky”)

@nugett,

I am recharging it now and will give this an examination.  I feel like I solved this for my own apps long ago and once I understood the source of the issue it wasn’t a problem anymore.

That said, I can’t remember the specifics now, so let me wait till I can give this a real test.

Cheers,

Ed