1

I hope to change the lock screen type from Password lock to Swipe lock programmatically, or from Password lock to None.

I have read the document How to change the lock screen type programmatically??

but there isn't same sample code, could you tell me how to do? Thanks!

Community
  • 1
  • 1
  • use dpm policy, device need to be device admin – KOTIOS Jan 29 '15 at 01:12
  • Thanks! Could you show some sample code, I have read http://stackoverflow.com/questions/9724428/how-can-i-set-up-screen-lock-with-a-password-programmatically, but I can't find how to change lock screen type. –  Jan 29 '15 at 01:20

1 Answers1

0

No, you cannot. There is no API for programatically changing the security settings on the device. You are limited to using the http://developer.android.com/guide/topics/admin/device-admin.html device admin interface to check if the current settings match your desired state.

The user must make the changes, though you can direct them to the security settings by triggering the ACTION_SECURITY_SETTINGS from the settings provider.

caskey
  • 12,305
  • 2
  • 26
  • 27
  • But I can change screen lock type from Swipe Lock to PIN lock using the code at http://stackoverflow.com/questions/9724428/how-can-i-set-up-screen-lock-with-a-password-programmatically why? –  Jan 29 '15 at 05:44