Vinay
Vinay

Reputation: 11

Release device without reset

I'm using android management APIs, able to enroll and apply policies to the device.

When I release the device, the device is getting reset, I want to release without reset.

I tried the delete option,

def delete_device(device_name):
    # delete a device, which also reformats the device
    result = (androidmanagement.enterprises().devices()
              .delete(name=device_name, wipeDataFlags=['PRESERVE_RESET_PROTECTION_DATA']).execute())
    print('\nDevice deleted: ', result)
    return result

even tried without wipeDataFlags argument, device is still getting reset, of course device is de registered.

have tried issuing the RELINQUISH_OWNERSHIP command also

def issue_command(device_name, command_type):
    # issue a command to a device
    command = androidmanagement.enterprises().devices().issueCommand(
        name=device_name,
        body={"type": command_type}
    ).execute()
    print('\nCommand issued: ', command)
    return command

def relinquish_ownership(device_name):
    issue_command(device_name, 'RELINQUISH_OWNERSHIP')

nothing happens after applying/calling relinquish_ownership, even device won't get released.

Upvotes: 0

Views: 144

Answers (1)

Ramakrishnaraj K
Ramakrishnaraj K

Reputation: 15

in case you need to delete the device which is COPE then only the RELINQUISH OWNERSHIP will work. In case of COSU or COBO there is no possible way to remove the management with out removing the data. Incase of the BYOD just deleting the device object from the AMAPI would do fine it will keep the personal profile unaffected.

[1]: https://developers.google.com/android/management/reference/rest/v1/ManagementMode but give it a try.

Upvotes: 0

Related Questions