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
Related
I'm working on an existing Android application for medical purposes.
The back button and home button should be disabled.
With the existing code, the back button is disabled.
For disabling the home button they used onAttachedWindow with LayoutParams TYPE KEYGUARD,
but this security hole is fixed since 4.0.
I tried a lot of similar questions, but none worked out for me.
What is the way to get this done these days?
Also, hiding the status bar on tablet (where the home & back button live) would do the trick,
so any suggestions there are equally helpful!
Update: also, free third party apps that do the hiding trick are okay!
This sounds like a kiosk or dedicated use kinda thing, yes? You want your app to "own" the tablet and prevent other usage? I did this for an app whose sole purpose was to act as a remote control for a custom device. Basically I created two apps, a "custom launcher" app and the app that did the remote control. It's probably possible to integrate the two, but I wanted to support both dedicated and non-dedicated use. Note that I gave the launcher app a password-protected way to access settings so that I could recover the tablet at any time.
You can find a number of tutorials that will guide you through creating a custom launcher, just strip out all the stuff that makes it a generic launcher and replace it with an image button or similar that launches the actual app, or replace the launcher activity with your main app activity. Warning: I never figured out how to remove the launcher except by going into the settings.
As for hiding the system bar (notifications and status icons at the top of the screen), you'll want to use a full-screen theme like #android:style/Theme.NoTitleBar.Fullscreen.
As for hiding the home button I took this approach:
View main_layout = this.findViewById(android.R.id.content).getRootView();
main_layout.setSystemUiVisibility(View.STATUS_BAR_HIDDEN);
Unfortunately the STATUS_BAR_HIDDEN flag is deprecated now, but I think some of the other options would have the same effect. Regardless, the best you can achieve within Android's intended use is to temporarily hide the navigation buttons (home and back). A tap on the screen will bring them back.
I am trying to build an android app in kiosk-mode in Android 4.2.2 (Jelly Bean). What I have achieved till now is to make the application as full screen and also handled the home and back buttons. However, my problem is, I want to remove the status/notification bar. I don't want the user to access any other settings through it. I have tried out many ways including the usage of different flags available in android WindowManager for having a screen devoid of the notification bar. However, none were helpful for that.
I have read about apps like Surelock which serve this purpose. Therefore, at least I know that there is something which can be done, except rooting, to remove the notification bar.
Can anyone please help me on this?
I'm developing an Android tablet app where I need to show fullscreen content. Entering and closing the app is done using a dedicated physical button on the device. When the button is pressed I want all other traces of the Android UI to disappear, and then reappear when we press the button again. I.e., a fullscreen app that is placed on top everything else.
Any ideas on how to achieve this? I've tried various approaches to no avail:
* Adding SYSTEM_UI_FLAGS* doesn't work for this purpose, as the SystemUI will reappear when touching the screen. Ideally we would also not like the animation when opening our fullscreen app.
* Adding a separate layer on top of what we believe is all other layers, but the SystemUI is still shown
Some kind of layering must be preserved. I.e., I need to show incoming call dialogs on top of the fullscreen app.
Please note: This question is about development in the framework/system part of Android. I'm not looking for answers on how to do it in regular user apps.
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.
In my application I have two Activities A and B. In Activity A, i disable the notification bar in manifest but in Activity B notification bar is enabled. While navigating from Activity A to Activity B there is some jerk in User Interface. Can any body help me in this.
I think jerk is happening because the phone/tablet on which you are testing either:
has a weak GPU and thus cannot render the transition fluidly, or
the version of Android does not support it.
This is not a problem with your app. Ideally there should be a smooth slide-in, like on my Nexus 7.
A nice way to solve it is by either having the notification-bar on in both Activities or off in both. No jerk :)
Have you tried performance testing your app? Your UI could be causing the problem. Do you see the same Jerk if you temporarily disable the notification bar? Have you tried using the Hierarchy Viewer on Activity B?