Search code examples
androidlockscreen

Change screen lock method


Is there a way to programmatically change the phones screen lock method? For example, changing it to display a pattern, a pin, swipe unlock or none at all.

For example, think of a widget that lets the user toggle between swipe to unlock and pattern lock.

Cyanogenmod has something like this in their profiles, using PROFILE_SERVICE but that does not seem to be in the public API.


Solution

  • Not exactly. Through DevicePolicyManager, you can specify some minimum quality characteristics for a password, and force the user to reset their password to meet those characteristics. However:

    • The user can always choose something stronger than what you require
    • This requires that the user configure your app as a device admin
    • This requires additional permissions
    • The user is always involved in the password-reset process