We are trying out Android Management API. and we are controlling apps by defining them in the policy.

Now for some reason, we need to allow the user to purchase the app or use an already purchased app (which will be the personal account i.e. gmail.com)

{
...

"applications": [
    {
      "packageName": <app_package_name>,
      "installType": "BLOCKED"
    },
    {
      "packageName": <app_package_name>,
      "installType": "AVAILABLE"
    }
  ]
}

But, the device enrolled in fully managed devices mode using Android Management API, the play store is managed and hence allows only {some_random_number}@android-for-work-gsearvices.com account to be used in play store. Other email accounts don't show up in the user selection of the play store, even after logging in from settings.

Please assist me to find the solution for the above thingy.

1

There are 1 best solutions below

0
On

There are two ways to do this:

1.) For personal use set up a company-owned device with a work profile this enables the device for both work and personal use to do this you need to allow personal usage in your enrollment token and add personalApplicationPolicy in your policy. This will set up a separate work and personal profile in which you can use your own app.

You can also check this https://developers.google.com/android/work/overview#company-owned-work-profile and https://developers.google.com/android/management/provision-device#company-owned_devices_for_work_and_personal_use to better understand how this works.

Sample Code:

Enrollment token

enrollment_token = androidmanagement.enterprises().enrollmentTokens().create(
    parent=enterprise_name,
    body={"policyName": policy_name,
          "allowPersonalUsage": "PERSONAL_USAGE_ALLOWED",
          "duration": "2592000 s"}
).execute()

In your policy

 "personalUsagePolicies": {
    "personalApplications": [
      {
        "packageName": [package name],
        "installType": "AVAILABLE"
      }
    ]
  }

2.) For work use you can work with the developer of the app to provide a license key that can be distributed to your users via a managed config for the specific application .