I am developing an android lock screen and need to disable the navigation bar. Using a launcher you can disable the home button and you can override the back button, but you cannot override the recents button. Is it possible to disable or clear the recents soft key temporarily?
Follow up question - has anyone been able to programmatically disable and enable the nav bar via root on jelly bean?
What about using lights out mode and overriding onSystemUiVisibilityChange while capturing the touch?
I have decompiled toddler lock - which implements this functionality, but it uses some hackery and the main activity is corrupted.
There is no way to this on a stock device. You'll have to customize the Android OS. Any 'hackery' you are seeing is likely to break with the next update. You can't really replace the system lock screen either.
Related
I'm currently writing an application which acts as a home screen/launcher.
When I'm on the home screen, I still have the back button visible in the navbar. Somehow Google manages to hide it in their Pixel launcher and I've read on GitHub that it's only possible to hide the back button if the application is a launcher (which is the case for my app).
Unfortunately the Android documentation covers only how to completely hide the navigation bar. I doubt that's the way Google went with their Pixel launcher and I suspect that there is some badly documented way of achieving this.
I was using startLockTask() in a program but found out it could only be used for Android L. However I want my application to function in versions lower then 5.
Is there any way I can gain similar functionality?
Functionally, no. The point of screen pinning is to prevent the user from leaving your app. The user can't see or click on notifications, or use the home button to leave.
Visually, you can set the app to full screen,, and/or hide notification bar. You can also hide the soft keys on devices that don't have hardware buttons. However, people can always bring it back up.
EDIT: You can also disable the back button.
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'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 have found non rooted apps which are capable of hide home button from bottom system bar of tabs (not all the devices but many of samsung tabs) & disabling (not hiding) right side wifi, settings entering panel in system bar (worked in all the testing devices). Good example is remote lock screen of Lookout premium app with BIND_DEVICE_ADMIN permission. This lock screen appears on top of the native android lock screen it has these features work in many devices.
Is there a way to create an activity with disabling System bar like that? Is it related to the flag that adding to the layout params of the activity? Otherwise how this is implemented?
Thanks.