0

When I change the policy name firstpolicy to secondpolicy on the device, the patch API response is 200 ok and it removes apps of first policy to apps of second policy from the play store app, but it did not remove them from the device. It still shows apps of the first policy.

  1. I am using an update mask.
  2. Testing fully managed device

Any help appreciated.

Daniel
  • 4,792
  • 2
  • 7
  • 20
vishu
  • 11
  • 5

2 Answers2

1

The stack overflow thread at Android Device Policy sync does not work until done manually mentions a reboot will force apply a policy, which isn't ideal but it does at least ensure a policy is updated. I'm also testing a fully managed device.

https://developers.google.com/android/management/reference/rest/v1/enterprises.devices/issueCommand details the standard for sending a command to a device. You can test it against live data with the API explorer on that page, so navigate towards the bottom of the page where it says 'Request Parameters' -> 'Name', and put in your enterprise & device ids of the form 'enterprises/your-enterprise-id/devices/your-device-id'. Then go to 'Request Body' and use the '+' sign to add 'type' : 'REBOOT' as a parameter. Press the execute button, in which you will be prompted to choose an account for OAuth2.0. After this, you will see the results, and if successful (returns a 200 code), it will issue the reboot command, with the policy being updated after rebooting.

To reiterate, I know this isn't ideal, but it at least does do an update, so just providing that info.

Good luck and let me know if everything worked out.

theDude
  • 132
  • 1
  • 9
  • I don't see how this brings an answer, maybe you could clarify? – Gwen Jul 16 '20 at 19:13
  • Sorry, I'm a new user and my reputation is low (can't comment). I'd have rather commented honestly than put it as an answer - just thought it would help the OP. I mentioned it was not ideal, but using the Android Management API to perform an enterprises.devices.issueCommand with request body { "type": "reboot" } to the device forces a policy update. I'll edit the post with more details. – theDude Jul 16 '20 at 19:47
  • It way better know ! – Gwen Jul 16 '20 at 20:10
0

It may take a while for the policy to sync and apply any changes, including removal of apps. You can force sync by opening the Android Device Policy app and touching the sync button. The other way is to issue a reboot command to the device to make sure that the new policy is applied. You can check the issueCommand method for more information.

Kevin
  • 321
  • 2
  • 19