Hiding Status Bar

Hi all,

I have been trying to hide the status bar from my android app, but no luck. The setStatusBar

display.setStatusBar(display.HiddenStatusBar)

function does not work. Here it says this is not supported Android 3.0.

However most of the games on play store which have been developed by corona have status bar hidden (e.g. grooh). So I think there has got to be a way around this. Please help me resolving this issue. [import]uid: 96683 topic_id: 35255 reply_id: 335255[/import]

Are they possibly using Corona Enterprise? I can confirm the status bar is removed on Android 2 and 4 OS variations. [import]uid: 202223 topic_id: 35255 reply_id: 140139[/import]

Corona definitely supports hiding the top status bar. Try running sample project “Interface/StatusBar” that is included with the Corona SDK on your Android device. Notice that it hides and shows the status bar based on timer, demonstrating that you can hide/show it dynamically.

Now, if you are talking about the bottom navigation bar on Android, then no, Corona does not support hiding it. This is because Android did not support hiding it until Android OS version 4.0 (API Level 14) as documented in the link below and we opted to be consistent between Android OS versions.
http://developer.android.com/reference/android/view/View.html#SYSTEM_UI_FLAG_HIDE_NAVIGATION
[import]uid: 32256 topic_id: 35255 reply_id: 140159[/import]

Yes, its navigation bar.

It causes orientation bugs.
For example: when device (android tablet 4.0 / 4.0.4) orientation changes Portrait to Landscape; a black empty bar shown at right of the screen. (at previous nav bar position and same width of navbar)
And app’s width-height changing. right black bar is offscreen area.

App’s starting orientation always looks good, but when orientation changes its causes width/height issues.

config.lua

width = 480,  
height = 800,  
scale = "none",  
fps = 30,  
antialias = true,  
xalign = "center",  
yalign = "center",  

I try scale = none and letterbox it causes same problem.

How can I run app like fullscreen or isolate from navigation bar orientation issues. [import]uid: 96683 topic_id: 35255 reply_id: 140518[/import]

Oh I see. Yes, this is a known issue on Android Tablets running Android 3.x or higher… and only with Corona apps that support portrait and landscape orientations. What’s happening is that when the device changes orientations, the bottom navigation bar moves too causing the screen to resize. That is, the actual aspect ratio of the application window changes instead of just swapping the width and height like most devices (particularly iOS) do. Corona currently does not handle resize events correctly and is a high priority bug on our to-do list.

Currently, the only work-around is to change your app’s build setting to only support one kind of orientation such as “portrait” and “portraitUpsideDown”… or “landscapeRight” and “landscapeLeft”. Unfortunately, this is the only work-around at the moment.

Also note that hiding the bottom navigation bar does not work-around this issue because it will re-appear when the end-user taps the screen, triggering a resize event and thus causing the above bug. I’ve tested this for myself several months ago and it does not solve the problem.
[import]uid: 32256 topic_id: 35255 reply_id: 140659[/import]

Are they possibly using Corona Enterprise? I can confirm the status bar is removed on Android 2 and 4 OS variations. [import]uid: 202223 topic_id: 35255 reply_id: 140139[/import]

Corona definitely supports hiding the top status bar. Try running sample project “Interface/StatusBar” that is included with the Corona SDK on your Android device. Notice that it hides and shows the status bar based on timer, demonstrating that you can hide/show it dynamically.

Now, if you are talking about the bottom navigation bar on Android, then no, Corona does not support hiding it. This is because Android did not support hiding it until Android OS version 4.0 (API Level 14) as documented in the link below and we opted to be consistent between Android OS versions.
http://developer.android.com/reference/android/view/View.html#SYSTEM_UI_FLAG_HIDE_NAVIGATION
[import]uid: 32256 topic_id: 35255 reply_id: 140159[/import]

Yes, its navigation bar.

It causes orientation bugs.
For example: when device (android tablet 4.0 / 4.0.4) orientation changes Portrait to Landscape; a black empty bar shown at right of the screen. (at previous nav bar position and same width of navbar)
And app’s width-height changing. right black bar is offscreen area.

App’s starting orientation always looks good, but when orientation changes its causes width/height issues.

config.lua

width = 480,  
height = 800,  
scale = "none",  
fps = 30,  
antialias = true,  
xalign = "center",  
yalign = "center",  

I try scale = none and letterbox it causes same problem.

How can I run app like fullscreen or isolate from navigation bar orientation issues. [import]uid: 96683 topic_id: 35255 reply_id: 140518[/import]

Oh I see. Yes, this is a known issue on Android Tablets running Android 3.x or higher… and only with Corona apps that support portrait and landscape orientations. What’s happening is that when the device changes orientations, the bottom navigation bar moves too causing the screen to resize. That is, the actual aspect ratio of the application window changes instead of just swapping the width and height like most devices (particularly iOS) do. Corona currently does not handle resize events correctly and is a high priority bug on our to-do list.

Currently, the only work-around is to change your app’s build setting to only support one kind of orientation such as “portrait” and “portraitUpsideDown”… or “landscapeRight” and “landscapeLeft”. Unfortunately, this is the only work-around at the moment.

Also note that hiding the bottom navigation bar does not work-around this issue because it will re-appear when the end-user taps the screen, triggering a resize event and thus causing the above bug. I’ve tested this for myself several months ago and it does not solve the problem.
[import]uid: 32256 topic_id: 35255 reply_id: 140659[/import]

@Josh For trying to hide the bottom status bar, is that something that someone with Enterprise license would be able to do on their own?

Thanks,

Andrew

Yes, this is possible via Corona Enterprise.  You would then have to set up the Android activity to use the “SYSTEM_UI_FLAG_HIDE_NAVIGATION” flag (API Level 14; Android OS 4.0) or the “SYSTEM_UI_FLAG_FULLSCREEN” flag (API Level 16; Android OS 4.1).

   http://developer.android.com/reference/android/view/View.html#SYSTEM_UI_FLAG_HIDE_NAVIGATION

   http://developer.android.com/reference/android/view/View.html#SYSTEM_UI_FLAG_FULLSCREEN

The “SYSTEM_UI_FLAG_HIDE_NAVIGATION” will display the activity fullscreen until the end-user taps on the screen.  Then Android will automatically display the navigation bar at the bottom again, which will also cause your app to be resized in the vertical direction.  The “SYSTEM_UI_FLAG_FULLSCREEN” flag always shows the activity in fullscreen, even when the end-user taps on your app.

That said, I have no idea if Kindle Fire devices will respect these flags.  They use a fork of the Android OS and do not follow all of the rules documented by Google.

[quote name=“Joshua Quick” post=“159027” timestamp=“1359373929”]Corona currently does not handle resize events correctly and is a high priority bug on our to-do list.[/quote] Wondering if this “high priority bug” has been fixed and if not how much longer might it take? Thanks.

We resolved the “resize” issue about a year ago.  In fact, we’ve introduced a new “resize” event to Corona which you can use on all platforms, which is a far superior means of re-laying out your app compared to the “orientation” event.  Have a look at the documentation here…

   http://docs.coronalabs.com/daily/api/event/resize/index.html

Super! Thanks for the quick response. Most appreciated.

Just a quick follow-up. When the end-user taps on the screen and Android automatically displays the navigation bar at the bottom does the resize event fire or is it only catching the orientation changes. If it catches the navBar at the bottom showing or hiding related resize events then we can respond and arrange our screen. No chance to test this right now hence the question. Thanks for your clarification.

I haven’t tried this for myself, but theoretically, most Android devices will raise a resize event, but a Kindle Fire HD will *not* raise a resize event.  The reason is because the bottom navigation bar on a typical Android device is not overlaid on top of the app, but steals screen real-estate instead.  However, a Kindle Fire HD’s bottom navigation bar is always overlaid on top.

I think thats fine. If as a rule on Kindle the bottom navigation bar is always overlaid on top then the end-users would be used to to that behavior and would not mind it when it happens to our apps. Its the opposite that worries me so if the resize is firing on all non-Kindle Android devices then thats a very good news. It would be great to put out a little sample that tests this behavior and ask fellow devs with Android 3 & 4 devices to try it out. Just an idea. 

This type of resize event is pretty easy to reproduce on a Nook HD (if you have one) via a Corona Simulator built app.  This is because the Nook HD’s screen lock is fullscreen, and when you return to your app from the screenlock, your app will be in fullscreen mode for a brief moment before the bottom navigation bar pops-in, causing your app to be resized vertically.  That was causing some havoc with some Corona developers a year ago who absolutely needed a resize event to resolve that issue.

Another interesting thing to note is that a resize event may change the content scale if the resize is not proportional.  For example, if only the height changes, then the content scale will definitely change.  This is commonly case the on Android 4.x devices.  Especially with apps that support both portrait and landscape orientation, because tablets will move the navigation bar with the app.  On Android 4.x phones, the navigation bar is in a fixed position, however it does slightly change size by a few pixels between portrait and landscape.  Note that you will never have this problem on iOS because orientation changes always swap the width/height, meaning you’ll have a proportional resize, preventing the scale from changing.

One more thing to note.  If the content scale does change, then Corona will automatically re-generate the textures for all of your text objects to match the new scale.  This is especially needed if the app is scaling “up” to prevent the text from looking blurry, because they’re really bitmaps/textures.

Anyways, I hope this helps!

Thanks Joshua. Always very informative and open. Your help is most appreciated. I will need to get my hands on a device to test all this soon. 

@Josh For trying to hide the bottom status bar, is that something that someone with Enterprise license would be able to do on their own?

Thanks,

Andrew