i am developing app which check whether user has selected any screen lock pattern or not .
if not i will call the intent to start activity to set the password then continue the app
so that i ask user to set the screen lock first by calling the
Intent intent =
new Intent(DevicePolicyManager.ACTION_SET_NEW_PASSWORD);
startActivity(intent);
Use
DevicePolicyManager.isActivePasswordSufficientto check whether password is set or not.You need to call
DevicePolicyManager.setPasswordQualityandbefore calling this function
Edit: Here’s the code.
Suppose you want the user to have any password to be set then use below code.
Ofcourse you will have to have all the permissions related to device policy manager