I am interested in building a custom lock screen app but would like to integrate into the built in system password lock screen.
My design idea is that the user would set a system password using the standard lock screen in android and my custom lock screen app would be given permission to bypass the standard lock screen and present them with a custom alternative way to unlock the device.
The user would be given the ability to fall back to the system lock screen if they wish. Also, this will give some leniency to my custom app just in case it does not work for whatever reason and woud allow a secure fallback to a system lock screen.
Is this possible in later versions of the Android SDK?
The short answer is no. You cannot edit the native android lock screens and security features related to them with the android sdk. You can however build your own and have that used if the native android lock screen is disabled, if it isn't you end up with two lock screens.
It may be possible to integrate in a minimal way with the "insecure" android lockscreen ie. swipe to unlock, which does not provide any security whatsoever.
Related
I moved from iPhone to Android (Samsung S7) and missing one feature. In iPhone I could use quick access to set clock and timer and set direct from locked screen if to press a button at quick access panel, shown at the picture with arrow. Is it possible to make a similar quick access to clock app in android from lock screen? To put it in android quick access panel or in some other way like third party app, etc: aiming to access clock app set on lock screen quick w/o logging in? Same question with Calculator app.
In Android you can do almost everything with apps.
I found here some apps that allow you to create widgets on your lockscreen, you click on them, unlock your screen, and the app launches:
https://www.maketecheasier.com/launch-apps-lockscreen-android/
I own a OnePlus so I know they have this option build in.
You can also use the Xposed module "GravityBox" or "LockscreenMods"
(it is not possible to bypass the unlockscreen through a lockscreen widget!)
I am developing a security app. So its necessary for me to put it on lock screen. Is there a way to put it on lock screen? so that user can interact directly when needed.
For devices with lockscreens that support app widgets, you can write an app widget that can be placed on the lockscreen.
I am building an app that will be in kiosk mode and must be over the lock screen its is possible using:
getWindow().addFlags(WindowManager.LayoutParams.FLAG_SHOW_WHEN_LOCKED);
However, I now need to programmatically lock the screen when the app is starting, looking at this link, I see it needs administrator privileges that are a bit more complicated on the lollipop version, has anyone managed that?
For your need, you can use the Screen Pinning. It's a new functionnality added in Android 5 to limit the application a task.
Programmatically, you can use Activity.startLockTask() and Activity.stopLockTask() to pin/unpin the application.
Some things to know :
If your application is not an Admin app, a popup will appear and you'll have to manually confirm the pinning mode.
No notifications will be shown in this mode.
The Home and Recent Apps buttons will have no effects.
you can unpin the application with no confirmation, and if you have set a Keyguard screen, you'll need to unlock it to go back to your Home application.
A few users have been asking me Android lock screen widgets for my app - I believe they want a widget that stays on their lock screens and allows them to interact with the app.
I haven't been able to find any official documentation for this - the only thing I found was apps that will take home screen widgets and put them on the lock screen for you.
Any clues on where I learn more about building true lock-screen widgets?
Lock screen interaction is difficult. Android allows basic operations with two window flags (FLAG_SHOW_WHEN_LOCKED and FLAG_DISMISS_KEYGUARD). FLAG_SHOW_WHEN_LOCKED works pretty consistently in that it will show on top of the lock screen even when security is enabled (the security isn't bypassed, you can't switch to another non-FLAG_SHOW_WHEN_LOCKED window).
If you're just doing something temporary, like while music is playing or similar, you'll probably mostly be okay. If you're trying to create a custom lock screen then there's a lot of unusual interactions on all the different android platforms. ("Help! I can't turn off my alarm without rebooting my HTC phone").
getWindow().addFlags(WindowManager.LayoutParams.FLAG_SHOW_WHEN_LOCKED);
getWindow().addFlags(WindowManager.LayoutParams.FLAG_DISMISS_KEYGUARD);
http://developer.android.com/reference/android/view/WindowManager.LayoutParams.html
FLAG_SHOW_WHEN_LOCKED
Window flag: special flag to let windows be shown when the screen is
locked.
FLAG_DISMISS_KEYGUARD
Window flag:
when set the window will cause the keyguard to be
dismissed, only if it is not a secure
lock keyguard. Because such a keyguard
is not needed for security, it will
never re-appear if the user navigates
to another window (in contrast to
FLAG_SHOW_WHEN_LOCKED, which will only
temporarily hide both secure and
non-secure keyguards but ensure they
reappear when the user moves to
another UI that doesn't hide them). If
the keyguard is currently active and
is secure (requires an unlock pattern)
than the user will still need to
confirm it before seeing this window,
unless FLAG_SHOW_WHEN_LOCKED has also
been set.
Constant Value: 4194304 (0x00400000)
Official Lock screen widget document is here
I had to implement a lock screen widget for my project. In the process, I accumulated a couple of resources.
If you have an app that you want to put on the lock screen, first make it an appwidget. You can use the AppWidget class to do this.
Now, use the AppWidgetHost class from the Android API to make your lock screen a host for the widgets. I don't know how to do this part, but there are some existing implementations like mylockandroid (links below).
Resources
http://code.google.com/p/mylockforandroid/
(NB This code is for older versions of Android. Android 4.2 and up has built in lockscreen widget support)
http://mylockandroid.blogspot.com/2010/03/widget-lockscreen-beta-11-r2.html
Let me begin by saying that, yes, I know that the stock Android lock screen can not be programatically replaced without rooting.
Now that that's over with, I want to make an app that contains a custom 'lock' mechanism. There are apps out there that emulate this functionality, namely LockGo. This allows a user to view information from widgets on a 'lock screen' and emulates the slide-to-unlock functionality (or whack-a-mole if the user wants to install that plugin).
Does anyone know what mechanism or Android API functionality they may have used to do this? Is it as simple as hooking into the power button to launch an activity, such as in the link below?
How to hook into the Power button in Android?
Any insight to this would be appreciated.
I've found out while researching this that, while there is currently no way to replace the stock security or keyguard lock (which I knew), it is possible to show an Activity on top of the lock using the following code in the setup for that Activity:
getWindow().addFlags(WindowManager.LayoutParams.FLAG_SHOW_WHEN_LOCKED);
This can be used with any logic needed to create a faux lock to show screens on top of the system lock(s), though the lock will still be in tact and the user will need to enter the lock to get into the device.