I'm creating an app and wanted to programmatically lock the device once the user taps a button.
I've searched online about this and the only stuff I found was lock screen orientation or some APIs to create a Lock-screen app.
I just wondering if a simple thing like thisDevice.lock(); or AndroidStuff.powerMgmt.lockScreen();. I mean, seems too basic and essential but I just can't find it
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'm building my app with Phonegap. What I want to do is create a button on the screen and add a lock-screen event onclick. I searches on other posts but everyone tries to check if the screen is locked and execute then or before something. I only need the event (lock screen) to happen when clicking that button. It's exactly like you would lock it from the physical button on the iPhone but only it happens by clicking a button.
I need it both for iOS and Android but if you could give me a hint for only one, is welcomed.
Thank you!
For Android side;
As far as i know you app need to be registered on the device as an admin app. Then you can use the Device Administration API to lock the screen by DevicePolicyManager.lockNow()
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.
How to create an android app that will appear on the lock screen and can be started even if the phone is lock?
Such that the application icon is visible on the lock screen instead of menu. Similar to emergency calls button on the lock screen.
Can anyone please help me out in this?
I read many things but was not able to find such thing please help me out.
Starting with Android 4.2, you can create lockscreen widgets. If the user places it on the lockscreen, it works mostly like any other widget.
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.