I've built a simple video player app for Android 4.2. I'd like to be able to programmatically show/hide the system bar while this app is playing video. I've read many threads here that indicate a device must be rooted in order to hide the system bar.
Then, I noticed that the Netflix app on my un-rooted Android tablet achieves the effect I'm after:
When the Netflix app is first launched, thee system bar is shown.
5 seconds after a video starts playing, the system bar icons slide down and are hidden.
Tapping the screen causes the system bar icons to slide back into view.
5 seconds later, the system bar icons slide out of view again.
How might I achieve this effect?
You're looking for setSystemUiVisibility() (See Documentation).
Specifically the SYSTEM_UI_* flags. In KitKat, they've added additional flags for immersive mode.
Related
Based on the Samsung Galaxy S8 auto-hide navigation keys, I want to make my own auto hide volume bar. It will be an app for playing TV series, made just for one particular device specific for not having any physical buttons.
Volume bar should be opened on bottom screen swipe and auto-hide in 2 sec if not used.
Something like this GIF.
How can I implement something like that in an app, not in the operating system itself?
I'd like to completely hide the status bar when in Immersive full-screen mode, for the purpose of running a kiosk app. All of the suggested solutions mention methods for preventing the status bar from getting fully expanded, but none show how to completely prevent the status bar from being displayed (then subsequently disappearing) when you drag down on the top of the screen. In Kiosk mode we don't want ANY ancillary activity occurring besides the dedicated app that is running on the device, despite how users may try to interact with the controls or screen.
Thanks in advance!
I am trying different options to disable system bar permanently for my android app. Now, the most successfully solution is stop the android systemui service.
service call activity 42 s16 com.android.systemui
But, this cause serious issues in my app. I have 3 android UI components on screen, 2 webviews and one videoView. Upon disabling the UI service, my webviews will show on screen for a second and then turn completely black(maybe disappeared). Only videoview is playing. Because I am refreshing the webview every 10seconds, the webview will shown up another second upon each refresh and gone. In addition, all my buttons are gone as well. Any suggestions? Thanks
How could you consider to stop system services?
You shouldn't mess with your users' devices!
Why didn't you just try to hide the Status bar and/or the Navigation Bar
Edit:
Another solution is to implement the Kiosk mode as in this tutorial or Screen pinning if devices are running Lollipop
I need to hide the navigation bar on a tablet with 4.0 completely. No user interaction should change this behavior. Right now I'm running the default Fullscreen View from Android Studio, but user interaction brings up the navigation bar.
Is there a way to do that without root?
Unless phone is rooted - you cannot override the standard behavior or Android OS.
In fullscreen mode i will be hidden, but can be still brought down when required.
You could set the app like a Launcher, hide the navigation bar, and root the phone, in order to set always run that.
The other option is root the phone, and make your own android version without the navigation bar.
I want to make my application go fullscreen in any android device. Hide the Title bar and also the notification bar. The application is supposed to run on a 10 inch tablet on Android 4.0.3.
I am using the following code but only the title bar disappears. I want to hide the notification bar also. Can anyone please tell me what I am doing wrong in my code ?
getWindow().requestFeature(Window.FEATURE_NO_TITLE);
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);
try this
getWindow().getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_HIDE_NAVIGATION);
Hope it helps.
Edit:
The SYSTEM_UI_FLAG_HIDE_NAVIGATION is a new flag that requests the
navigation bar hide completely. Be aware that this works only for the
navigation bar used by some handsets (it does not hide the system bar
on tablets). The navigation bar returns to view as soon as the system
receives user input. As such, this mode is useful primarily for video
playback or other cases in which the whole screen is needed but user
input is not required
.
The thing holding the navigation buttons back and home, time, network information etc is referred to as "navigation" bar.
You can not hide it within the given framework, but it is possible if rooting the device is an option for you:
Root device
Install and run Busybox
Install HideBar
In HideBar there is an option to run in 'Kiosk' mode, in which there is no way to re-display the navigation bar. Needless to say, you really need to be careful with this.
This question was also asked here:
Android tablet navigation bar won't hide
How to remove system bars on Android, I mean, all
Android tablet navigation bar won't hide
Is there a way to hide the system/navigation bar in Android ICS
Hide Tablet system bar
Real Fullscreen with Android 4 Tablets
Easy way to hide system bar on Android ICS