3

I am creating an app to lock the screen if user has set any lock. And if he has not set any lock , app will redirect it to lock screen in settings to let user set the lock first. I have used Device Admin permission to lock the screen and KeygaurdManager.isDeviceSecure method to check if it has been set or not .

But i am unable to find how to redirect user to lock screen programmatically. Please help.

Thanks in advance.

SimpleCoder
  • 1,665
  • 1
  • 21
  • 34

1 Answers1

11

Possible duplicate of this SO Post

Have you tried doing this to navigate the user to a specific Settings Page -

Intent intent = new Intent(DevicePolicyManager.ACTION_SET_NEW_PASSWORD);
startActivity(intent);

For opening the Security Settings use this -

Intent intent = new Intent(Settings.ACTION_SECURITY_SETTINGS); 
startActivity(intent);

Moreover you can find here the constants for all the possible Actions that you can use in your app to redirect the user to a particular page on the Setting screen.

Let me know if this is not what you were looking for.

hsm59
  • 1,991
  • 19
  • 25