ronelle
ronelle

Reputation: 61

Unable to Set Device Policy Android Phone

I am encountering an error setting the device owner on an android device using the steps below. This has worked in the past on other devices:

  1. Perform Factory reset
  2. Enable debug mode on device
  3. From command line run the following on the connected device:

    adb install -r myapp.apk
    adb shell "dpm set-device-owner com.mydomain.myapp/.ServiceDeviceAdminReceiver"
    

The following error occurs:

java.lang.IllegalStateException: Not allowed to set the device owner because there are already some accounts on the device

Under Settings > Accounts (there are no accounts listed)

Under Settings > Security > Device Administrators (there are 2 apps and both are unchecked): Android Device Manager

Myapp

I then ran the following commands and received the following output:

adb shell pm list users
Users:
    UserInfo{0:Owner:13} running


adb shell dumpsys device_policy
Current Device Policy Manager state:
    Enabled Device Admins (User 0):

    mPasswordOwner=-1

Any suggestions on what I can do to set the device owner?

Upvotes: 6

Views: 968

Answers (1)

Bhavya Shah
Bhavya Shah

Reputation: 89

You need to remove all accounts from the device too, that means no sign in of any sort, even google, skip that step after factory reset

Upvotes: 1

Related Questions