2

I am able to set SCREEN LOCK password programmatically using Device Administrator in Android, but is there any way to remove this SCREEN LOCK or even to change to "SLIDE" option? Below is my working code

devicePolicyManager.setPasswordQuality(demoDeviceAdmin,DevicePolicyManager.PASSWORD_QUALITY_UNSPECIFIED);
                    devicePolicyManager.setPasswordMinimumLength(demoDeviceAdmin, 5);
                    boolean result = devicePolicyManager.resetPassword("123456", DevicePolicyManager.RESET_PASSWORD_REQUIRE_ENTRY);

Remember below code to reset won't work:

devicePolicyManager.setPasswordQuality(demoDeviceAdmin,DevicePolicyManager.PASSWORD_QUALITY_UNSPECIFIED);
                    devicePolicyManager.setPasswordMinimumLength(demoDeviceAdmin, 5);
                    boolean result = devicePolicyManager.resetPassword("", DevicePolicyManager.RESET_PASSWORD_REQUIRE_ENTRY);

&& is not a permanent solution as it disables keyguard only till the application is in stack or alive

KeyguardManager keyguardManager = (KeyguardManager)getSystemService(Activity.KEYGUARD_SERVICE);
KeyguardLock lock = keyguardManager.newKeyguardLock(KEYGUARD_SERVICE);
Cœur
  • 37,241
  • 25
  • 195
  • 267
user45678
  • 1,504
  • 6
  • 29
  • 58

0 Answers0