Search code examples
androidandroid-5.0-lollipopdevice-admin

How to set device password using managed profile in Android 5.0


I am working on managed profile application in android 5.0 while trying to set password using code given below.

manager.resetPassword("123456",DevicePolicyManager.RESET_PASSWORD_REQUIRE_ENTRY);

But it's throwing an exception like Caused by: java.lang.SecurityException: You can not reset the password for a managed profile. is there any work around to set the password using managed profile owner. Thanks in advance.


Solution

    1. java.lang.SecurityException is because managed profile owner cannot reset the primary user's password.
    2. The managed profile owner can set the password quality but resetting the password is not allowed.