Search Unity

  1. Unity 2019.1 beta is now available.
    Dismiss Notice
  2. The Unity Pro & Visual Studio Professional Bundle gives you the tools you need to develop faster & collaborate more efficiently. Learn more.
    Dismiss Notice
  3. We're looking for insight from anyone who has experience with game testing to help us better Unity. Take our survey here. If chosen to participate you'll be entered into a sweepstake to win an Amazon gift card.
    Dismiss Notice
  4. Want to provide direct feedback to the Unity team? Join the Unity Advisory Panel.
    Dismiss Notice
  5. Unity 2018.3 is now released.
    Dismiss Notice
  6. Improve your Unity skills with a certified instructor in a private, interactive classroom. Watch the overview now.
    Dismiss Notice

Status Bar Always Hidden on Android

Discussion in 'Android' started by lloydg, Oct 22, 2015.

  1. lloydg

    lloydg

    Joined:
    Mar 23, 2015
    Posts:
    36
    Anyone else having this issue in 5.2.1 and 5.2.2?

    Status bar is always hidden, 'Status Bar Hidden' PlayerSettings has no effect.

    -Create a new project
    -Switch platform to Android
    -Uncheck Status Bar Hidden in player settings
    -Build and Run
    -note: status bar is hidden even though you told it not to be

    (if the box is ticked or not the status bar is always hidden)

    https://fogbugz.unity3d.com/default.asp?733366_v5du7tf6jqc7dfc2
     
    Sincoyw likes this.
  2. jeremymassey

    jeremymassey

    Joined:
    Oct 22, 2013
    Posts:
    1
    Yep, same for me too.
     
  3. lloydg

    lloydg

    Joined:
    Mar 23, 2015
    Posts:
    36
    in 5.3 change docs:
    "Android: Remove "Hide status bar" option in the Player Settings, now it is always hidden"

    Why would they remove this feature?

    My app is more of a casual app and I want the status bar available. This is very annoying.
     
  4. Yury-Habets

    Yury-Habets

    Unity Technologies

    Joined:
    Nov 18, 2013
    Posts:
    983
    Please don't mix up the status bar



    and the navigation bar



    In order to show the navigation bar (and disable immersive mode on KitKat+ and "lights out" mode on JellyBean), you can use the following code in your script:

    Code (CSharp):
    1. void Start ()
    2. {
    3.     Screen.fullScreen = false;
    4. }
    5.  
    The status bar will still be hidden (at least it happens so on my Nexus 6).
    This is easy.


    If you really need the status bar, you can override the theme used in the manifest (for example, use
    THEME_NOTITLEBAR), subclass Unity activity (or use your own activity) and add the following code to onCreate():

    Code (Java):
    1. window.clearFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN);
    Please be informed that it won't work with the Native activity (it needs additional code to adjust native touches).
     
    LightingBox2 and lloydg like this.
  5. lloydg

    lloydg

    Joined:
    Mar 23, 2015
    Posts:
    36
    Thanks, however there is no confusion. I am talking about the status bar, the thing at the top that shows the time and such.

    Thanks for this info.

    Do you know why they removed the easy way of doing this? (with the tick box in the editor)
     
  6. Yury-Habets

    Yury-Habets

    Unity Technologies

    Joined:
    Nov 18, 2013
    Posts:
    983
    @lloydg : glad to hear there's no confusion on the status bar thingy - I've seen that quite a few times.

    Actually, it was me who removed this feature. It was causing more issues than gaining profit. The behavior was also non-intuitive - you had to set fullScreen and the player setting tick, different version of Android handled that in a different way etc. The team decided this feature could be removed.

    Also, there were some issues with it for quite a long time without anyone even noticing. You are the first :) So I'm trying to provide you with the necessary info on how to bring it back, if this is something you really need.
     
    nelsonlarocca likes this.
  7. luisescobariii

    luisescobariii

    Joined:
    Jan 9, 2016
    Posts:
    1
    Hi, I am sorry to reply to an old thread, but I am new to Unity and Android development in general. I would like to keep the status bar visible in my app but I don't really understand how to apply the fix you provided. Could you please explain in more detail how to modify the manifest to add your code, or point me in the right direction if it has been discussed somewhere else. Thank you.
     
  8. OJ3D

    OJ3D

    Joined:
    Feb 13, 2014
    Posts:
    33
    Hey guys, found the perfect fix for the nav/status bar in android. I needed it in my app and saw that the status bar setting in player settings works for ios, but not android. Check it out on Zeh's website - http://zehfernando.com/2015/unity-t...-status-bars-and-implementing-immersive-mode/

    His source code is also on GitHub - https://github.com/zeh/unity-tidbits/blob/master/application/ApplicationChrome.cs

    It's super easy to implement and works like a charm. I'm using the latest unity 5.2.3

    -OJ
     
    doggan likes this.
  9. yye4520

    yye4520

    Joined:
    Mar 9, 2016
    Posts:
    3
    I really need this feature:(I really need this status bar:(
     
    nelsonlarocca and Sincoyw like this.
  10. VenomUnity

    VenomUnity

    Joined:
    Apr 6, 2013
    Posts:
    29
    Come on guys, all of us don't make games to go full screen. Please provide steps how to bring the status bar back.
     
    nelsonlarocca likes this.
  11. yye4520

    yye4520

    Joined:
    Mar 9, 2016
    Posts:
    3
    I may never use unity5.x again.:(
     
  12. yye4520

    yye4520

    Joined:
    Mar 9, 2016
    Posts:
    3
    Can be added in the next version and the status bar?
     
  13. Sincoyw

    Sincoyw

    Joined:
    Sep 22, 2015
    Posts:
    10

    Hi there, now our app have not only one Activity, so is there any way i can Init the status bar in the application Init
     
  14. Yury-Habets

    Yury-Habets

    Unity Technologies

    Joined:
    Nov 18, 2013
    Posts:
    983
    CyberScopes likes this.
  15. MalcomCZ

    MalcomCZ

    Joined:
    Sep 26, 2014
    Posts:
    6
    The plugin works great! But please, add this feature back to Unity. In Android 4.4 and later, disable Screen.fullScreen = true when the status bar is visible or hide status bar when setting Screen.fullScreen to true. Anyway it makes no sense to remove this feature from Unity.
     
  16. Yury-Habets

    Yury-Habets

    Unity Technologies

    Joined:
    Nov 18, 2013
    Posts:
    983
    Thanks for the feedback @MalcomCZ .
    We have 4 combinations of statusbar on/off + fullscreen on/off, multiplied by devices before 4.4 and after. Total: 8 cases, some of them make no sense to me, different users are expecting different behavior. It's very unlikely that this feature will be introduced back.
     
  17. Yury-Habets

    Yury-Habets

    Unity Technologies

    Joined:
    Nov 18, 2013
    Posts:
    983
    I've got a request (for the plugin) to apply status bar visibility before the splash screen is shown. I'll check whether I can do anything with it.
     
  18. MalcomCZ

    MalcomCZ

    Joined:
    Sep 26, 2014
    Posts:
    6
    Ok, I understand that it's quite difficult to deal with all the Android combinations. The plugin is sufficient enough. However I need to recompile some other Android libraries that I use.

    It would be great to apply status bar visibility before the splash screen. Or more precisely to be able to start the app in non fullscreen mode with both navigation bar and status bar visible.
     
    Yury-Habets likes this.
  19. HeaDiii

    HeaDiii

    Joined:
    May 18, 2015
    Posts:
    57
    I'm not quite sure how to get this to work.
    I downloaded the provided .zip file from github and dragged the Plugins-Folder into my project.
    On GitHub it says, i need to pay attention to the manifest and use the provided one.
    What is this manifest and how do i use it?
     
  20. Yury-Habets

    Yury-Habets

    Unity Technologies

    Joined:
    Nov 18, 2013
    Posts:
    983
  21. Yury-Habets

    Yury-Habets

    Unity Technologies

    Joined:
    Nov 18, 2013
    Posts:
    983
    @HeaDiii : it's quite hard to explain the whole Android ecosystem thing in a short post...
    Start with this http://developer.android.com/guide/topics/manifest/manifest-intro.html

    Actually, if you have a simple app, the Assets/Plugins/AndroidManifest.xml from GitHub should do the job for you. Just copy it to your project, the same path. If not - then it may require some manual work, especially if you have Android plugins. There's no universal recipe/step-by-step manual here, sorry.

    EDIT: I will think of the easier integration ways for the plugin, but no promises here :)
     
    l-keustermans and HeaDiii like this.
  22. domharris

    domharris

    Joined:
    Jan 15, 2016
    Posts:
    2
    When switching to a different app and returning, it flickers between status bar on and off, before settling with off. Could be because I'm on the N preview, but I just thought I'd flag it. Any idea how to stop it?
     
  23. Yury-Habets

    Yury-Habets

    Unity Technologies

    Joined:
    Nov 18, 2013
    Posts:
    983
    @domharris I'll check it by the end of the week.
     
  24. domharris

    domharris

    Joined:
    Jan 15, 2016
    Posts:
    2
    D'oh - hadn't attached the script that sets Screen.fullScreen to false to a GameObject. Interestingly it squashes everything when entering text.
     
  25. IanPozz

    IanPozz

    Joined:
    Apr 11, 2016
    Posts:
    4
    Hi, I've just encountered a time where I need to use this plug-in but when it shows the status bar it's always black. I'm struggling to change it to transparent, is it possible to have a transparent status bar?

    Thanks.
     
  26. Yury-Habets

    Yury-Habets

    Unity Technologies

    Joined:
    Nov 18, 2013
    Posts:
    983
    @IanPozz : I will check that. If you create a report in GitHub - it will not get lost. :)
     
  27. IanPozz

    IanPozz

    Joined:
    Apr 11, 2016
    Posts:
    4
    @Yury-Habets many thanks for this. It's most appreciated. I've created a report on GitHub :)
     
    Yury-Habets likes this.
  28. mtana

    mtana

    Joined:
    Aug 30, 2016
    Posts:
    1
    @Yury-Habets Thanks for your help. I managed to use your plugin but at the moment during the splash screen the navigation bar disappears and then came back once the scene is loaded (after calling the Scene.fullscreen = false). This is how is supposed to work or I'm missing something?

    Thanks in advance for your answer.
     
  29. Yury-Habets

    Yury-Habets

    Unity Technologies

    Joined:
    Nov 18, 2013
    Posts:
    983
    @mtana it is caused by Unity internally setting
    Code (CSharp):
    1. fullscreen = true
    before the splash screen, while the script setting it to false gets executed first frame after the splash screen. Most likely there is no good fix for it. Sorry for the bad news o_O
     
  30. JamJam7

    JamJam7

    Joined:
    Jul 2, 2014
    Posts:
    1
    Hi Yuri, using 5.4.0f3 here,not sure if it supposed to be like this, kitkat+ everythings perfect, status bar overlay my ui and all, jelly bean and < , i have to manually remove the plugin because fullscreen =true\false did not change anything,was set on false anyway, and it is also normal that the status bar "push" my ui canvas down? it messes up all my scales :(
     
  31. Yury-Habets

    Yury-Habets

    Unity Technologies

    Joined:
    Nov 18, 2013
    Posts:
    983
    @JamJam7 translucent status bar is supported on KitKat+. So on JellyBean and before, you just get a normal status bar, causing your surface to be reduced by the size of the status bar.

    Please read the "Effect" section in readme https://github.com/Over17/UnityShowAndroidStatusBar - it explains things. Feel free to get back if you still have questions :)
     
    GMT likes this.
  32. BeringelaUnity

    BeringelaUnity

    Joined:
    Jun 9, 2016
    Posts:
    4
    Hi Yuri,

    Apologies for slightly diverting the thread, but my requirement is so close to this and of all my research this is the best fit.

    Basically I want to prevent that android bubble saying "swipe down from the top to exit full screen" that appears when in immersive or full screen modes. My goal is to have that bubble not appear.

    I tried this plugin, and unfortunately the bubble still appears (only once though, but I want it prevented always). My game can start non-immersive and non-full screen, whatever it takes to get that bubble to not appear.

    Would it be possible to adapt this plug-in to prevent that bubble appearing? I thought the plugin was going to work, because it clears all the immersive/full screen flags.

    Many thanks,
    Beringela.
     
    Last edited: Dec 5, 2016
  33. Yury-Habets

    Yury-Habets

    Unity Technologies

    Joined:
    Nov 18, 2013
    Posts:
    983
    @BeringelaUnity will take a look. Can you please create a GitHub issue so that I don't forget?
     
  34. BeringelaUnity

    BeringelaUnity

    Joined:
    Jun 9, 2016
    Posts:
    4
    Many thanks Yury-Habets, I've raised an issue.

    I was also wondering, if I was to buy a Plus license, and thus have the opportunity to suppress the splash completely, then that might prevent the bubble appearing too. If that's an option, I'd be happy to buy a license.
     
  35. CyberScopes

    CyberScopes

    Joined:
    Oct 25, 2014
    Posts:
    7
    Hi, really like this plugin, actually helps a lot with the app.

    Just had a quick question, is it possible to have a translucent status bar but an opaque navigation bar? And if so how can I implement it?

    Thanks again!

    EDIT: Nvm got it to work by editing flags within styles.

    Although my scalings a bit messed up now but thats another problem :D
     
    Last edited: Dec 10, 2016
    Yury-Habets likes this.
  36. CyberScopes

    CyberScopes

    Joined:
    Oct 25, 2014
    Posts:
    7
    I came across an issue today, it seems that while this plugin is in use, on some devices (my HTC 10 on android 6.0) inputfields/keyboards become bugged - the edit box with the 'OK' doesnt appear above the keyboard and is hidden under it, so inputfields cant actually be edited, but only entered for the first time. I tried removing the plugin and the issue was fixed. I tested this on another device running android 5.0.x and there were no issues, even with the modded manifest.

    Is there any possible reason/solution for this?

    Thanks
     
  37. codegasm

    codegasm

    Joined:
    May 3, 2015
    Posts:
    18
    I am having the same issue with the edit box and OK button not showing up after adding the plugin. After testing a bunch of different things I noticed that this doesn't happen when using the non-transparent version (UnityStatusBarTheme). This is an acceptable workaround for me right now but I've created an issue over at Github, please feel free to add your details there also: https://github.com/Over17/UnityShowAndroidStatusBar/issues/3
     
    CyberScopes likes this.
  38. Yury-Habets

    Yury-Habets

    Unity Technologies

    Joined:
    Nov 18, 2013
    Posts:
    983
    Thanks guys for reporting the issue. I'm investigating it. Looks like an Android bug. Might require changes in the Unity code as well...
     
    CyberScopes likes this.
  39. JudUnity

    JudUnity

    Joined:
    Jan 12, 2017
    Posts:
    1
    Hi , can I hide the navigation bar while displaying the status bar with this plugin?

    EDIT:I had a misinterpreting.
    Thanks, My problem has been solved.
     
    Last edited: Jan 18, 2017
  40. Yury-Habets

    Yury-Habets

    Unity Technologies

    Joined:
    Nov 18, 2013
    Posts:
    983
    @JudUnity : what do you mean by "hide the navigation bar"?
    If you mean the immersive fullscreen mode in Kitkat+ - then it hides the satus bar.
    If you mean the "ligths out" mode - you may try using the plugin and *not* setting fullscreen to false in the scripts (just comment it out). Please let me know if it works for you. :)
     
  41. Shikshen

    Shikshen

    Joined:
    Feb 21, 2015
    Posts:
    12
    Is there really no way to prevent Unity from automatically calling fullscreen = true on launch?

    My problem is that Screen.width and Screen.height return the dimensions of the whole screen, navigation bar included, if called before immersive mode was effectively disabled (setting Screen.fullscreen = false is asynchronous), so my measurements on launch are wrong because the immersive mode is still active for a few frames when the app starts.

    I made the app assuming that the screen size never changes so this breaks several things since I updated to Unity 5, which has no way to disable the immersive mode completely.

    Am I stuck with Unity 4 to keep my project working?
     
  42. Yury-Habets

    Yury-Habets

    Unity Technologies

    Joined:
    Nov 18, 2013
    Posts:
    983
    @Daimas no, on startup fullscreen is set to true.
    One of the reasons is to have a nice fullscreen splash screen!
    So - measure the size of the screen a bit later. For example, have the first scene act as a splash screen, then move on to the second one and measure its size. Or (add your solution here)

    > I made the app assuming that the screen size never changes
    This does not sound like a valid assumption.
     
    iluhin-pro likes this.
  43. CyberScopes

    CyberScopes

    Joined:
    Oct 25, 2014
    Posts:
    7
    Hi, any updates on this issue so far?
     
  44. Yury-Habets

    Yury-Habets

    Unity Technologies

    Joined:
    Nov 18, 2013
    Posts:
    983
    Not yet.
    The first solution in the Unity code didn't work. Looking further.
     
    CyberScopes likes this.
  45. Yury-Habets

    Yury-Habets

    Unity Technologies

    Joined:
    Nov 18, 2013
    Posts:
    983
    Update:
    The "hidden" input and OK button were fixed (in Unity codebase).
    The plugin was updated to be an AAR - only one file (+manifest), much easier to add/manage in the Unity project.
    Available on https://github.com/Over17/UnityShowAndroidStatusBar
     
    KaroDev and JohnTube like this.
  46. LessThanEpic

    LessThanEpic

    Joined:
    Aug 22, 2014
    Posts:
    9
    Sorry, I'm a little bit of a newb when it comes to messing with the Android manifest and plugins, but I can't get it to build. I always get the following error:

    Moving
    Temp/StagingArea\android-libraries\unityShowAndroidStatusBar\classes.jar to
    Temp/StagingArea\android-libraries\unityShowAndroidStatusBar\libs\classes.jar:
    The system cannot find the file specified.

    UPDATE: The previous version (0.3) builds fine and works great. It's 0.4 with the aar that I can't get to work.
     
    Last edited: Aug 27, 2017
  47. Yury-Habets

    Yury-Habets

    Unity Technologies

    Joined:
    Nov 18, 2013
    Posts:
    983
  48. Carappene

    Carappene

    Joined:
    Aug 24, 2017
    Posts:
    3
    Hi. It throwed me two errors: I had to change
    <uses-sdk android:minSdkVersion="9" android:targetSdkVersion="23" />
    to:
    <uses-sdk android:minSdkVersion="14" android:targetSdkVersion="24" />
    so I could build to my device.
    It does not show the status bar and it doesnot shot the navigation bar. I followed the instructions given in github, but I can't get it to work (I'm really noob when it comes to Android Manifest...).
    This is the complete AndroidManifest that I got from Temp/StagingArea when it was building, maybe it can help getting a solution...

    <?xml version="1.0" encoding="utf-8"?>
    <manifest xmlns:android="http://schemas.android.com/apk/res/android" android:versionCode="6" android:versionName="0.6" package="com.unpuzzle.GooglePlayConfig" android:installLocation="preferExternal">
    <supports-screens android:anyDensity="true" android:largeScreens="true" android:normalScreens="true" android:smallScreens="true" android:xlargeScreens="true" />
    <application android:icon="@drawable/app_icon" android:label="@String/app_name" android:theme="@StyLe/UnityTransparentStatusBarTheme" android:debuggable="false" android:isGame="true" android:banner="@drawable/app_banner">
    <activity android:label="@String/app_name" android:name="com.unity3d.nostatusbar.UnityPlayerActivityStatusBar" android:screenOrientation="portrait" android:launchMode="singleTask" android:configChanges="mcc|mnc|locale|touchscreen|keyboard|keyboardHidden|navigation|orientation|screenLayout|uiMode|screenSize|smallestScreenSize|fontScale|layoutDirection">
    <intent-filter>
    <action android:name="android.intent.action.MAIN" />
    <category android:name="android.intent.category.LAUNCHER" />
    <category android:name="android.intent.category.LEANBACK_LAUNCHER" />
    </intent-filter>
    <meta-data android:name="unityplayer.UnityActivity" android:value="true" />
    </activity>
    <activity android:configChanges="fontScale|keyboard|keyboardHidden|locale|mnc|mcc|navigation|orientation|screenLayout|screenSize|smallestScreenSize|uiMode|touchscreen" android:name="com.unity.purchasing.googleplay.PurchaseActivity" android:theme="@android:style/Theme.Translucent.NoTitleBar.Fullscreen" />
    <activity android:configChanges="fontScale|keyboard|keyboardHidden|locale|mnc|mcc|navigation|orientation|screenLayout|screenSize|smallestScreenSize|uiMode|touchscreen" android:enableVrMode="com.google.vr.vrcore/com.google.vr.vrcore.common.VrCoreListenerService" android:name="com.unity.purchasing.googleplay.VRPurchaseActivity" android:theme="@StyLe/VrActivityTheme">
    <intent-filter>
    <action android:name="com.google.vr.vrcore.ACTION_NONE" />
    <category android:name="com.google.intent.category.DAYDREAM" />
    </intent-filter>
    </activity>
    <!-- Required for Nearby Connections API -->
    <meta-data android:name="com.google.android.gms.nearby.connection.SERVICE_ID" android:value="" />
    <!-- The space in these forces it to be interpreted as a string vs. int -->
    <meta-data android:name="com.google.android.gms.games.APP_ID" android:value="\ 823316474503" />
    <!-- Keep track of which plugin is being used -->
    <meta-data android:name="com.google.android.gms.games.unityVersion" android:value="\ 0.9.41" />
    <!-- Build time check to make sure play-services libraries are present -->
    <meta-data android:name="com.google.android.gms.version" android:value="@Integer/google_play_services_version" />
    <activity android:excludeFromRecents="true" android:exported="false" android:name="com.google.android.gms.auth.api.signin.internal.SignInHubActivity" android:theme="@android:style/Theme.Translucent.NoTitleBar" />
    <!--Service handling Google Sign-In user revocation. For apps that do not integrate with
    Google Sign-In, this service will never be started.-->
    <service android:exported="true" android:name="com.google.android.gms.auth.api.signin.RevocationBoundService" android:permission="com.google.android.gms.auth.api.signin.permission.REVOCATION_NOTIFICATION" />
    <activity android:exported="false" android:name="com.google.android.gms.common.api.GoogleApiActivity" android:theme="@android:style/Theme.Translucent.NoTitleBar" />
    <meta-data android:name="unity.build-id" android:value="1ad2ba99-10fe-4237-8e6e-a36baddfc120" />
    <meta-data android:name="unity.splash-mode" android:value="0" />
    <meta-data android:name="unity.splash-enable" android:value="True" />
    </application>
    <uses-sdk android:minSdkVersion="14" android:targetSdkVersion="24" />
    <uses-permission android:name="android.permission.INTERNET" />
    <uses-permission android:name="com.android.vending.BILLING" />
    <!-- Indicates use of Android's VR-mode, available only on Android N+ -->
    <uses-feature android:name="android.software.vr.mode" android:required="false" />
    <!-- Indicates use of VR features that are available only on official "VR-ready" devices -->
    <uses-feature android:name="android.software.vr.high_performance" android:required="false" />
    <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
    <uses-feature android:glEsVersion="0x00020000" />
    <uses-feature android:name="android.hardware.vulkan" android:required="false" />
    <uses-feature android:name="android.hardware.touchscreen" android:required="false" />
    <uses-feature android:name="android.hardware.touchscreen.multitouch" android:required="false" />
    <uses-feature android:name="android.hardware.touchscreen.multitouch.distinct" android:required="false" />
    </manifest>
     
  49. Yury-Habets

    Yury-Habets

    Unity Technologies

    Joined:
    Nov 18, 2013
    Posts:
    983
    The manifest looks correct to me. If you could share your project (you can do it in private messages if you want), I can try it out.
     
  50. Carappene

    Carappene

    Joined:
    Aug 24, 2017
    Posts:
    3
    Hi, sorry for the late response, forgot I posted this and couldn't even find this post. Somehow after some days it just worked, randomly (I guess it wasn't really random but I couldn't tell what we changed).

    We now ran into a new problem. Navigation Bar.

    Maybe this is not the appropiate post to ask about it, but since you are a Unity developer, I thought let's give it a try.
    We made visible (opaque) both status and navigation bar. Problem is, in the Android devices that have navigation bar, our "game" "ends" at the end of the device screen, not when the navigation bar starts, which sometimes "eats" some content.

    Is there any way to check through Unity if the Android device that is using the app has/doesn't have navigation bar, and if so, will our Scene "end" where it should, instead of the navigation bar "eating content"?

    I'm really sorry if my english isn't the best, I apologize. If you need some aclarations I will do my best.

    PS: This time I will be checking everyday if you answered me, thanks in advance! <3
    PS2: Is there any way we can change the status bar color? It's always a very strong grey :/
     

    Attached Files: