We are testing the Android Management API for our organization,and we found a workaround to the managed play store: If a user adds his personal account to the device (to access Gmail, for example), he can switch to that account in the Play Store and download apps which are not allowed by the policy.
Although the DPC (Android Device Policy) deletes the app on the next policy sync, for some reason that sync does not happen automatically whenever an app is installed. The Device Policy app only syncs if either: 1) the admin pushes a change to the policy through the API, or 2) the user manually syncs through the app.
Which means that the user can install any app he wants, and use it until the policy syncs.
Is there any way to prevent the user from downloading apps from outside the managed play store account, or to make the Device Policy app auto-sync whenever an app is installed?
This is the policy that I applied to the test devices and the patch code:
import json
test_policy_name = enterprise_name + '/policies/test'
test_policy_json = '''
{
"applications": [
{
"packageName": <app_package_name>,
"installType": "BLOCKED"
},
{
"packageName": <app_package_name>,
"installType": "AVAILABLE"
}
],
"installAppsDisabled": false,
"playStoreMode": "WHITELIST",
"installUnknownSourcesAllowed": false
}
'''
androidmanagement.enterprises().policies().patch(
name=test_policy_name,
body=json.loads(test_policy_json)
).execute()