Reputation: 3596
I was able to implement locking and unlocking of Screen-Lock programmatically. But I was wondering if its possible to change the mode of Screen-Lock say from 'slide' to 'pattern' or 'password' programmatically.
I searched the net but could'nt find anything, all results were about the usual locking and unlocking which I have already done.
Can any1 tell me if its possible ? If yes then how shall I achieve it.
Any help will be appreciated :) Thanks in advance :)
Upvotes: 3
Views: 4227
Reputation: 82938
You can use Device Administration API. And DeviceAdminSample is a good start.
There are following types you can set using setPasswordQuality()
DevicePolicyManager.PASSWORD_QUALITY_UNSPECIFIED,
DevicePolicyManager.PASSWORD_QUALITY_SOMETHING,
DevicePolicyManager.PASSWORD_QUALITY_NUMERIC,
DevicePolicyManager.PASSWORD_QUALITY_ALPHABETIC,
DevicePolicyManager.PASSWORD_QUALITY_ALPHANUMERIC,
DevicePolicyManager.PASSWORD_QUALITY_COMPLEX
There are several answers on SO
How can i set up screen lock with a password programmatically?
How can i lock the android device with a password programmatically
Upvotes: 4