androidpolicyandroid-management-api

Android Management API change Policy for device


I created 2 policies in my enterprise.

I would like to switch one device to the other policy without re-enroling it.

I tried to use android management enterprises devices.patch with following JSON

{ "policyName": "policy2" }

this link

When i execute this command i always get follwoing error Message:

{
 "error": {
  "code": 400,
  "message": "Illegal state transition from ACTIVE to DEVICE_STATE_UNSPECIFIED",
  "status": "INVALID_ARGUMENT"
 }
}

Does anybody know how to change policy for a device without wiping it?


Solution

  • i foudn a solution for my problem:

    { "policyName": "policy2" , "state":"active"}