Is it possible to create an app on iphone and android that is accessible before the authentication screen, just like the "emergency dialler".
I searched on google but I cant seem to find relevant information.
On Android perhaps, depends on what you want exactly. You can make an app that appears above the keyguard by specifying FLAG_SHOW_WHEN_LOCKED. You can make it turn on the display with a wakelock or the flag FLAG_KEEP_SCREEN_ON. You can make it dismiss the keyguard with FLAG_DISMISS_KEYGUARD . But some of these will only work with a non-secure keyguard (one that doesn't require a password).
Related
Background
Smart Lock feature allows to fully unlock the device under certain conditions, such as GPS location, connected Bluetooth, etc...
The problem
I'd like to make an app that does that, with other special conditions.
Given user's approval, is it possible to completely unlock the lock screen, even if it has a password, so that the user will continue as if he unlocked the device by himself?
What I've found
I know it's probably possible using accessibility service, to mimic user actions of entering the code or drawing the pattern.
There is probably a way to temporarily disable the lock screen, by using keyguard API (written here for example), but as I've read, those are deprecated and might not work on some devices and Android versions. I guess it also requires to have a foreground service for it to continue staying on this state.
The questions
Is there a better way? Is there a way to unlock the device, just like Smart Lock feature?
If so, how?
Is it true the Keyguard API is not recommended? What is there to worry about when using it? Or maybe it's completely safe to use, and can be used to fully unlock?
I am working on an android app that should be used by students in some kind of practical test.
I am using the screen pinning that was introduced in Lollipop (startLockTask()), so when my app is launched the user needs to allow the locking.
I couldn't find a way to know when the user click ok for the locking and when he unlock the pinning? (The user can cancel the lock by holding both the Back and Recent buttons).
I am not looking for a way to know if the user currently in lock screen (getLockTaskModeState ()), i want to know if i have a way to handle the events of locking or unlocking.
I want that in the begining of the test i will be able to send information to my server if the users 'logged in' properly (by allowing the lock), and as well if the user unlock the device before the end of the test.
EDIT
Hey, people!
Please explain yourselves after downvoting!
If I wasn't exaplaining myself - i will try again if you will let me know.
I read a lot of questions and answers about general lock screen, but not the one of app pinning, I also read about check the status of the current task- if it is locked or not, but i didn't find answer to what i am asking - is there a way to handle the event of unlocking the 'screen pinning' of a specific app.
So please, explain your downvotes!
Device Admin Recevier class give you the event of pinning and unpinning... However the example use the class when the installed app is provisioned for device owner.. Not sure if you could use it. You may refer to this too : How to be notified when screen pinning is turned off in Android 5.0 Lollipop?
https://developer.android.com/reference/android/app/ActivityManager.html#getLockTaskModeState()
Just use the function as stated in the link.
I'm trying to create a new lock screen and I'm aware that if I use the FLAG_DISMISS_KEYGUARD for use with non-secured lock screens, I can present multiple functions and don't have any restrictions to intent access.
However, I've been having a very difficult time identifying what limitations are implemented if the user had a secure (password, pin, pattern, etc) keyguard active and I use the FLAG_SHOW_WHEN_LOCKED.
For example, if my activity is visible over the keyguard and the user wanted to change the background of the activity to a picture they took, they cannot access the gallery to select the photo if the phone is locked.
I couldn't find anything in the Android SDK documentation or on here (or anywhere for that matter) that could answer what other functions are disabled. Any and all help is greatly appreciated!
Thanks!
In Android, you can go to system settings and enable screen locking whereby you can require a password, PIN, or some other means of unlocking the screen. This is typically used if you put your device into standby mode or it goes into standby mode after the screen dims out.
What I would like to do is to re-use this screen locking within my app but to prevent access to a particular activity. I would have a button that when pressed brings up the screen lock activity where the user must enter their PIN. If they enter it correctly, I then let them have access to the activity, otherwise they cannot use it.
Is it possible to re-use the screen locking activity in this scenario? If so, what API do I need? Would be nice if it worked on Android 2.3
EDIT:
Some of you are assuming that my app REQUIRES a PIN or password to operate. That is not the case. Users who want to protect certain data in my app can require it to have a PIN or password in order to view it. But why write my own password/PIN activity or dialog when the system already has one.
That kind of security is only available to inbuilt system components, like the settings app. Third party apps cannot request for the password dialog to be shown, and only continue working if the user enters the correct code.
Additionally, a decent amount of users simply do not have a pass code on their device.
You could look at KeyguardManager and KeyguardManager.KeyguardLock. There seems to be a change in how this functionality works starting in API level 13, but I'm not familiar with the topic in general, so you'll have to investigate that if you plan to go this route.
You are probably better off implementing something self contained in your app. It's very easy to cover the screen (perhaps with another Activity) or to hide UI elements programmatically and show an alternate UI with a password input field or something.
You can use the Screen locking feature from Android 2.2 itself.So, it will work in 2.3 easily.The method to use this feature can be done in basically two ways.
1st one is.
There are two way you can lock the screen:
PowerManager manager = (PowerManager) getSystemService(Context.POWER_SERVICE);
manager.goToSleep(int amountOfTime);
The second one is
PowerManager.WakeLock wl = manager.newWakeLock(PowerManager.PARTIAL_WAKE_LOCK,Your Tag");
wl.acquire();
wl.release();
The permission is also needed.that is
<uses-permission android:name="android.permission.WAKE_LOCK" />
I am developing an application where I have to change the screen lock password on a button click,can anybody tell me how can I do this.
If you are talking about the unlock pass word set in the device settings by the user then the answer is you can't.
If an application could change the unlock password/pattern without user interaction then these security features would be mostly useless. A rogue application could in theory lock the user out of their own device if this were possible.
Edit: if your aim is not to change this value without interaction but just to send them to the correct settings page. You might be able to do that some how. You'd want to look into what intents you can use to start the Settings Activities. But if you are developing this application for use by the general public I would strongly recommend you rethink having try to do anything with the users security settings. As a user if an application prompted and then sent me to the security settings page with the intention of having me change something in there I would immediately uninstall it.
Edit 2: I've never seen it until just now so I don't know for sure what they used to achieve that. Since it states that must be android 2.2+ though I would assume they are using the Device Administration APIs The docs seem to indicate that it can "Prompt user to set a new password." Which I would think means that it is just going to start the settings activity for them. It is not actually changing the password value by itself. This whole API is subject to user activation also. So even if you get installed on a device the user must explicitly "activate" your app before it is able to make use of any of the admin APIs
I am sure the only way this is possible is if you signed your APK with the device key. This way it could access API's that are limited to system applications. This isn't possible for a normal app, only one that is baked into a custom ROM or device manufacturer ROM when building Android from source.
I do not exactly understand what you are trying to do. If you wish to change the lock screen password programmatically, and your'e application is A device administration than you can call:
resetPassword method of DevicePolicyManager like this for example:
m_policyManager.resetPassword("bla bla", DevicePolicyManager.PASSWORD_QUALITY_SOMETHING);