In Android when in Immersive Mode, swiping in from the bottom or other edges (based on current orientation) reveals the status bar and navigation bar (which auto-hides later). I want to trigger this programmatically by touching the fingerprint scanner. How can I achieve this? There are some commands in the Android shell to emulate a swipe action programmatically, but is this that the only way to do this?
I wrote an app that is composed by a full screen webkit object. So, as soon as the activity starts, i set these flags:
SYSTEM_UI_FLAG_LAYOUT_STABLE
SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION
SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
SYSTEM_UI_FLAG_HIDE_NAVIGATION
SYSTEM_UI_FLAG_FULLSCREEN
SYSTEM_UI_FLAG_IMMERSIVE
Problem is that when i swap down from the top border of the screen, status bar and navigation bar becomes visible (and this is ok, so you can close the app if you need it). Problem is that, after a few seconds, status bar goes away while navigation bar doesn't. It stucks there. Is there a flag I am missing? Or is there any hook I can use to detect when the status bar hides and then set back the flags?
I want to permanently disable navigation and status bar for my android application i have used immersive mode for that but when i touch anywhere on screen the navigation and status bar reappears and on touching again on screen it goes back.I just want that all the navigation bar and status bar should not come when my application is running at any of the scenario please help.
That is not possible without root. With root permission you can achieve this but still its not a preferred.
Is it possible to permanently hide Navigation/Status Bar under Android 4.2.2
This solution seems not working under Jelly Bean.
I have GalaxyTab 3 (10.1) and hidding of Status Bar has no effect.
It's hidden on application Start on every screens, but i can expand it.
Problem occurs also after rooting device.
Somebody has faced it before (there is also video how to fix it):
forum.xda-developers.com/showthread.php?p=37466852
So my question is:
Is there any way to do this on application level?
Chris Banes and Roman Nurik have develop this usefull tool to controls the System UI easily
https://gist.github.com/chrisbanes/73de18faffca571f7292
No, it seems like there is no way to do this for your entire application on tablets running 4.+. Also, fully disabling it so it never appears is NOT possible.
However, the solution you linked does sort of work for Android 4.2.2, (tested on Nexus S and 10 inch tablet on emulator) but even when it works it reloads the status bar if certain user interactions occur to allow navigation (for example, pressing the menu button on a phone). So this means you should plan on spamming the flag every now and then.
I personally tried with this code in my oncreate:
View decorView = getWindow().getDecorView();
int uiOptions = View.SYSTEM_UI_FLAG_FULLSCREEN;
decorView.setSystemUiVisibility(uiOptions);
// Remember that you should never show the action bar if the
// status bar is hidden, so hide that too if necessary.
ActionBar actionBar = getActionBar();
actionBar.hide();
Which resulted in:
With the 4.2.2 phone the actionBar below also disappears, this does not seem to be possible for tablets.
Coming from the Android documentation about hiding the status bar, it seems that on Android 4.0 or lower, you would be able to set the fullscreen flag for the entire application and be done with it, but this has been changed to the piece of code above.
Next, the UI documentation has this to say:
The SYSTEM_UI_FLAG_LOW_PROFILE flag replaces the STATUS_BAR_HIDDEN flag. When set, this flag enables “low profile" mode for the system bar or navigation bar. Navigation buttons dim and other elements in the system bar also hide. Enabling this is useful for creating more immersive games without distraction for the system navigation buttons.
So I guess it could be that the galaxy tab 3 requires some playing around with these kinds of flags and does not support actually hiding the status bar but rather prefers making it "less visible" ...
Finally, the setSystemUiVisibility method has some great examples if you're still interested in making sure the status bar stays hidden throughout your application.
Please note, that the status bar and the navigation bar are two completely different things. The navigation bar contains the back, home, and recent apps buttons, while the status bar contains the notifications, clock, battery, etc... The status bar can be easyly hidden with flags like SYSTEM_UI_FLAG_FULLSCREEN, but more convenient, using this as your app base theme:
android:theme="#android:style/Theme.NoTitleBar.Fullscreen"
In tablets, the navigation bar often consists the status bar, so if the navbar is visible, the status bar will be too. You can't just hide the status bar, because then you would have to hide the nav bar too.
The purpose of you can't hide the navigation bar forever, is that the user must be able to control his device and navigate as he wants to.
You can't hide the navigation bar before 4.0, and as in the developer guide says, you can hide the nav bar with the SYSTEM_UI_FLAG_HIDE_NAVIGATION flag, however, it won't stay hidden once the user touches the tablet. More explanation here: Android Developers - Hiding the Navigation Bar
In 4.4 KitKat, a new API was introduced, the immersive mode, with that you can hide the navigation bar and still make the user to be able to interact with your app, without the navigation bar revealing itself. The user can swipe down from the bottom of his screen to make it visible again, this clears the SYSTEM_UI_FLAG_IMMERSIVE flag. If you want to make the navigation bar disappear when the user doesn't interact with it, then you can use the SYSTEM_UI_FLAG_IMMERSIVE_STICKY flag, so it will disappear if the user finishes with it. More explanation here: Android Developers - Android 4.4 API
Also immersive tutorial: Android Developers - Using Immersive Full-Screen Mode
Also, make sure you are targetting the API 19, and only use this flag, when your app runs on API 19 or later. More on checking API version: Here (StackOverflow)
Hiding the Status Bar under Android 4.2.2 (SDK 17)
This solution worked for me.
getWindow().getDecorView().setSystemUiVisibility(8);
try this..its working for me..
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,windowManager.LayoutParams.FLAG_FULLSCREEN);
this.requestWindowFeature(Window.FEATURE_NO_TITLE);
setContentView(R.layout.about_app_phone);
}
How to hide StatusBar in Android 4:
Help me, please.
The bar that is shown in the image in your question is called the system bar.
On devices with no hardware buttons the system bar will always be displayed if user input occurs. You can call setSystemUiVisibility with the flags SYSTEM_UI_FLAG_HIDE_NAVIGATION and request the following window feature FLAG_FULLSCREEN via the Window. This should hide the system bar and make your view fullscreen as long as the user does not interact with the screen. If the user touches the screen the system bar will reappear to allow the user to use the home and back software keys.
If you have a view that the user will interact with but you want him not to be distracted by the system bar you can set the SYSTEM_UI_FLAG_LOW_PROFILE flag. This should dim the system bar and make it less distracting.
I agree with Janusz. You can not get 100% true full screen in Android 4.0.
Use the following to dim the notification bar (aka. status bar, system bar)
getWindow().getDecorView().setSystemUiVisibility
(View.SYSTEM_UI_FLAG_LOW_PROFILE);
And use this to hide it
getWindow().getDecorView().setSystemUiVisibility
(View.SYSTEM_UI_FLAG_HIDE_NAVIGATION);
And, if I guess right, you are trying to achieve a "kiosk mode". You can get a little help with an app named "surelock". This blocks all the "home" and "back" actions.
If you wish a smooth experience without an intermediate "jerked" layout, here is the solution from API level 14.
final Window window = getWindow();
if (isFullScreen == true)
{
window.addFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN);
// This flag will prevent the status bar disappearing animation from jerking the content view
window.addFlags(WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS);
window.clearFlags(WindowManager.LayoutParams.FLAG_FORCE_NOT_FULLSCREEN);
}
else
{
window.addFlags(WindowManager.LayoutParams.FLAG_FORCE_NOT_FULLSCREEN);
window.clearFlags(WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS);
window.clearFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN);
}
you can hide it. just use following api in OnCreate() method
requestWindowFeature(Window.FEATURE_NO_TITLE);