How to unlock an Android phone remotely

I wrote an application that removes an Android phone remotely. That is, when a special code is sent from the server, then the application blocks the phone based on a special code. This is the code I'm using.

if (!mDPM.isAdminActive(mDeviceAdminSample)) { // try to become active – must happen here in this activity, to get result Intent intent = new Intent(DevicePolicyManager.ACTION_ADD_DEVICE_ADMIN); intent.putExtra(DevicePolicyManager.EXTRA_DEVICE_ADMIN,mDeviceAdminSample); intent.putExtra(DevicePolicyManager.EXTRA_ADD_EXPLANATION,"Admin is added to do security operation."); startActivityForResult(intent, 0); } else { // Already is a device administrator, can do security operations now. mDPM.lockNow(); } 

The code above works and locks the phone.

I can unlock the phone by entering the password from the soft keyboard. Is there a way to unlock it with code?

My question is how to unlock the phone with a code. (This unlocking must be done remotely, as I explained for locking)

+44
android
Aug 14 2018-12-12T00:
source share
8 answers

I believe that you cannot override the built-in screen lock unless you create your own device, such as Samsung and HTC. However, if your customers use your own screen-like application, you are likely to be able to achieve what you are trying to do.

+6
Dec 13
source share

I do not think your remote unlocking goal is achievable.

As Android is configured, many applications can have device administrator privileges, and any device administrator can issue a lock command, but unlocking must be done by the user.

I can suggest that you simplify this: your application may try to remove the key lock password, and then the user can use the device without a code, simply by sliding a finger across the screen.

Now there is what I suggested if your application is not the only device administrator. In this case, some other administrator application may set a minimum password length (or some other password restriction) that will prevent your application from releasing a screen lock password.

If your goal is to help the user forget the screen lock password, then your server can invent a new password, inform the user that the new password, and also send a new password to your application and your application, can apply the password. Then the user can unlock the phone. Do not worry, it is not as difficult as it seems.

+5
Dec 10 '12 at 4:40
source share

Sorry to write - Unable to unlock phone from code. If you find any way to do this - no guarantees for the job. Thus, there is no possibility of remote unlocking, recording custom lock screens, etc.

+4
Dec 12 '12 at 21:29
source share

You need to use mDPM.resetPassword ("", 0)

http://developer.android.com/reference/android/app/admin/DevicePolicyManager.html#resetPassword(java.lang.String , int)

When the password string is set to "", the current password is replaced with a blank value, and the screen lock disappears.

+3
Jun 04 '13 at 9:29
source share

try it

 KeyguardManager manager = (KeyguardManager)context.getSystemService(KEYGUARD_SERVICE); kl = manager.newKeyguardLock("my-remote-app"); kl.disableKeyguard(); 

// to re-enable keyboard lock on exit (if you need to)

 onDestroy() { kl.reenableKeyguard(); } 

it works <= ICS. This is an obsolete api, they suggested you use the WindowManager flags for a similar effect. Although I could not create a similar effect using WindowManger.

Hope this helps,

+2
Aug 14 '12 at 12:29
source share

Please note that I am not an Android developer, but:

If you look at this , it looks like you can ask WindowManager to reject the security key if you have the correct permission, even if you are in β€œsecure lock” mode.

+1
Aug 14 '12 at 12:19
source share

As I know, we cannot unlock a password-protected phone programmatically.

+1
Dec 13 '12 at 12:31
source share

One solution would be to write "custom lockscreen". Of course, this is not the easiest way, but it will work the way you can do whatever you want with your own lockscreen. If you are considering this solution, do not hesitate to contact me, I will give you useful links. Hurrah!

0
Dec 14
source share



All Articles