-1

I am using device default lock screen in my app for activating and deactivating screen lock. In my application I used a check box which shows that screen lock is activated or not.

Intent intent = new Intent(DevicePolicyManager.ACTION_SET_NEW_PASSWORD);
startActivity(intent);

I am receiving it callback in my DeviceAdminReceiver class.

Methods:onPasswordChanged onPasswordFailed onPasswordSucceeded

Now if user selects none or press back none of these methods get called. I am not able to identify is screen is locked or not ? I used OnActivityResult for handling callback in my Activity, it works fine for back pressed(resultcode 0) but gives same results for all other options.

I found this link which tells that it can't be handled externally.

Summary: I wants to handle screen lock options directly from my application.

Community
  • 1
  • 1
Akhilesh Mani
  • 3,502
  • 5
  • 28
  • 59

1 Answers1

0

if we set password quality on that case user can not able to select none password option Might it will help you . We can do this in this way

private ComponentName mDeviceAdmin;
private DevicePolicyManager mDPM;

mDPM.setPasswordQuality(mDeviceAdmin, DevicePolicyManager.PASSWORD_QUALITY_SOMETHING);

Intent intent = new Intent(DevicePolicyManager.ACTION_SET_NEW_PASSWORD);
mContext.startActivity(intent);
DeltaCap019
  • 6,532
  • 3
  • 48
  • 70
Prags
  • 2,457
  • 2
  • 21
  • 38