Alexander
Alexander

Reputation: 48262

How to check that screen lock has a password?

I'm currently checking if there is a screen lock password with:

DevicePolicyManager.getgetPasswordMinimumLength() != 0

so if I see that the length is 0 I conclude there is no screen lock password and I prompt user to set one with DevicePolicyManager.ACTION_SET_NEW_PASSWORD.

I wonder though if it's a correct method of checking whether a screen lock password has been set?

Upvotes: 1

Views: 1158

Answers (1)

nandeesh
nandeesh

Reputation: 24820

Use DevicePolicyManager.isActivePasswordSufficient to check whether your password policy is sufficient instead of getPasswordMinimumlength

Upvotes: 1

Related Questions