Distribute apps

The Google Play EMM API supports the following distribution methods for public and private apps:

Manually install apps from the managed Google Play store

You can define which apps are available for a user to install in the Device's policy and set it by calling Devices.update. When provisioning a new device, you should set the policy before adding the managed Google Play Account to the device, otherwise the policy won't be applied for a short period of time after adding the account to the device.

The managed Play Store behavior is defined by the value of policy.productAvailabilityPolicy:

  • all: All public apps from the Play Store are available.
  • whitelist: Only the apps listed in policy.productPolicy are available.

In both cases, all apps in policy.productPolicy are added by default to the enterprise's store layout. The enterprise's store layout is the homepage of the managed Play Store when whitelist is selected, and can be accessed in a "Work Apps" tab when all is selected. You can allow your customer to customize the enterprise's store layout by embedding the managed Google Play iframe (see Organize apps with the managed Google Play iframe).

Remotely install apps onto user's devices

To remotely install (also called push install) an app on a user's device, set policy.productPolicy.autoInstallPolicy in the Device's policy. When provisioning a new device, you should set the policy before adding the managed Google Play Account to the device, otherwise the policy won't be applied for a short period of time after adding the account to the device.

The autoInstallMode can be set to:

  • doNotAutoInstall: The app is not automatically installed.
  • autoInstallOnce: The app is automatically installed once, if the user uninstalls the app it won't be installed again.
  • forceAutoInstall: The app is automatically installed, if the user uninstalls the app it will be installed again. On managed devices the DPC should block uninstall using DevicePolicyManager.setUninstallBlocked.

In case of failure (loss of connectivity, lack of storage, etc), installs are retried automatically until they succeed. An exponential backoff retry strategy is applied to avoid wasting battery and data in the case of unrecoverable failures.

Install priority

You can choose the order of installs by setting autoInstallPriority. The priority must be an unsigned integer and the default value is 0. Apps will be installed in increasing order or priority, meaning that apps with the lower priority value will be installed first.

Install constraints

You can set install constraints for each app by setting an autoInstallConstraint, allowing you to control the required state of the device during the install:

  • whether the device should be connected to a Wi-Fi network,
  • whether the device should be charging,
  • and whether the device should be idle (not actively used by the user).

If the constraints are not met immediately then affected installs will be queued until the constraints are met.

In an autoInstallConstraint the AND rule is applied between the fields. For example, with the following autoInstallConstraint, the device must be both charging and connected to an unmetered network (e.g. Wi-Fi) for the app to be installed:

"autoInstallConstraint": [
  "chargingStateConstraint" : "chargingRequired",
  "networkTypeConstraint" : "unmeteredNetwork"
]

Auto-install apps on newly provisioned devices

The Google Play EMM API sends a NewDeviceEvent notification when a device is first provisioned. To automatically push-install apps onto newly provisioned devices, listen for NewDeviceEvent notifications. From each NewDeviceEvent, retrieve the userId and deviceId, and then call Devices.update to set the policy for that device.

To learn how to subscribe to EMM notifications, see Set up EMM notifications.

Distribute apps for closed testing

Closed testing allows app developers to get feedback on early versions of their app from trusted users. Developers can set up closed tests in the Google Play Console. You use the Play EMM API to enable IT admins to distribute closed versions (also called tracks) of apps to specific users. Your enterprise customers can use this feature to not only test 3rd party apps, but also to test private apps developed in-house.

Eligible apps

Before a developer adds an enterprise to an app's list of closed testers, the app should meet the following criteria:

  • A production version of the app is published on Google Play.
  • In the Google Play Console, Managed Google Play is enabled in the app's Advanced Settings page.
  • Any closed versions of the app meet version code requirements.

Add an enterprise to closed tests

App developers can add enterprises to tests that use the methods Closed Alpha Testing, or Alpha Testing using Google Groups. For instructions, see guide on how to set up an open, closed, or internal test. The developer needs to enter the organization ID (also referred to as enterprise ID) of each participating enterprise. IT admins can provide their organization's ID to 3rd party app developers by following these steps:

  1. Sign in to the managed Google Play store.
  2. Click Admin Settings.
  3. Copy the Organization ID string from the Organization information box and send it to the developer.

Additional requirements for private apps

For private apps, the developer also needs to add the organization ID of each participating enterprise in the Managed Google Play tab of the app's Advanced Settings page. For instructions, see Publish a private app.

Distribute closed tracks to users

To retrieve a list of tracks available to an enterprise for a specified app, call Products.get. The appTracks[] list contained in the response includes the tracks available for each app. The appTracks[].trackAlias is a user readable name for the track that you can display in your EMM console, and the appTracks[].trackId is the machine readable ID for the track.

To grant a user visibility to an app's closed track, set the policy.productPolicy[].trackIds[] in the Device's policy. If multiple tracks are available for a device, the available version with the highest version code will be installed.

The trackIds will be automatically removed from Products.get call in certain scenarios such as the following:

  • Track's APK is promoted to another track or to the production.
  • The production version is updated with a higher version than the track.
  • A developer stops the track.

Keep track of paid app licenses

For paid apps the Grouplicenses object keeps track of how many licenses an enterprise owns and how many licenses are in use. You can call Grouplicenses.get to obtain license details for an app.

Before a paid app can be installed on a device, the enterprise needs to have a license available for the app. If a license is available, the app is installed on the device and an Entitlements object is created. An Entitlements object links a license with a user and decrements the available license count for the app. If there are no licenses available, then app installation fails and no Entitlements object is created.

Grouplicenses and Entitlements objects are not used by applications that are distributed without charge.