Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Programmatically changing ScreenLock mode from "Slide" to "Pattern" Android

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 :)

like image 990
ik024 Avatar asked Feb 02 '26 07:02

ik024


1 Answers

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

like image 111
Pankaj Kumar Avatar answered Feb 04 '26 20:02

Pankaj Kumar



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!