Configure apps

Some apps designed for enterprises include built-in settings called managed configurations that IT admins can configure remotely. For example, an app may have the option to only sync data when a device is connected to Wi-Fi. Providing IT admins the ability to specify managed configurations and apply them to devices is a requirement for all solution sets.

The diagram below illustrates some of the key stages of managed configuration management with an overview of the options available through the Google Play EMM API.

managed configurations

Check if an app supports managed configurations

Use Products.getAppRestrictionsSchema to determine whether an app supports managed configurations. Here's an example that uses the Google Play EMM API Client Library for Java.

public AppRestrictionsSchema getAppRestrictionsSchema(String enterpriseId,
    String productId, String language) throws IOException {
  return androidEnterprise
     .product()
     .getAppRestrictionsSchema(enterpriseId, productId, language)
     .execute();
}

All apps return an app restrictions (managed configurations) schema. If the call returns an empty schema, then the app doesn’t support manage configurations. If the call returns a schema containing a set of restrictions, then the app supports managed configurations. For example, an app that has a property for enabling remote printing over a VPN could return the following response to Products.getAppRestrictionsSchema.

    {
      "kind": "androidenterprise#appRestrictionsSchema",
      "restrictions": [
        {
          "key": "printing_enabled",
          "title": "Enable printing",
          "restrictionType": "bool",
          "description": "Allow user to print from the app",
          "defaultValue": {
            "type": "bool",
            "valueBool": true,
          }
        },
        {
          "key": "vpn_configurations",
          "title": "VPN configurations",
          "restrictionType": "bundle_array",
          "description": "List of VPN configurations",
          "nestedRestriction": [
            {
              "key": "vpn_configuration",
              "title": "VPN configuration",
              "restrictionType": "bundle",
              "nestedRestrictions": [
                {
                  "key": "server",
                  "title": "VPN server URL",
                  "restrictionType": "string"
                },
                {
                  "key": "username",
                  "title": "VPN account username",
                  "restrictionType": "string"
                }
              ]
            }
          ]
        }
      ]
    }

Specify managed configurations

For apps that support managed configurations, you can enable IT admins to set them from your EMM console by embedding the managed configurations iframe or by developing your own UI.

Option 1: Embed the managed configurations iframe

The easiest way to support managed configurations is to embed the managed configurations iframe into your EMM console. The iframe retrieves the managed configurations schema for a specified app, and allows IT admins to save, edit, and delete custom configuration profiles. You can use the Play EMM API to apply custom profiles to user’s devices. To learn more about the iframe and how to add it to your console, see managed configurations iframe.

Option 2: Create your own UI

Using the configurations returned from Products.getAppRestrictionsSchema, you can create your own UI that allows IT admins to manage app configurations.

Apply managed configurations

In order to apply managed configurations to devices, your DPC must be integrated with the DPC Support Library, as detailed in Build a device policy controller. The DPC Support Library transparently handles the delegation to Google Play to apply managed configurations.

You can apply managed configurations to all a user’s devices (Managedconfigurationsforuser) or to a specific device (Managedconfigurationsfordevice).

  • Managedconfigurationsforuser.update: Applies the app’s managed configuration to the specified user's devices. Managed configurations are applied per user by default, unless a per-device configuration exists.

  • Managedconfigurationsfordevice.update: Applies the app's managed configuration to a specific device. Per-device managed configurations override per-user configurations for the app on the specified device.

Using an mcmId

Each time an IT admin saves a new configuration profile from the managed configurations iframe, the iframe returns a unique identifier called mcmId. To apply a configuration profile to a user’s devices, call Managedconfigurationsforuser.update and pass the profile’s mcmId as a parameter. It’s not possible to apply an mcmId to a specified device (using Managedconfigurationsfordevice.update) at this time.

Define configuration variables

Some apps let IT admins set configuration values for variables, such as $FirstName, $LastName. When you apply a configuration profile to a user’s devices, you need to define any variables contained in the profile.

Using a list of managed properties

You can also include a set of managed properties with Managedconfigurationsforuser.update or Managedconfigurationsfordevice.update. The example below shows an update to a configuration for a specific device. The configuration settings contain a bundle_array (a list) that's made up of two bundle properties (a group of related properties, in this case, properties for a VPN).

    ManagedConfiguration managedConfiguration = new ManagedConfiguration()
      .setManagedProperty(
        ImmutableList.of(
            new ManagedProperty()
                .setKey("printing_enabled")
                .setValueBool(true),
            new ManagedProperty()
                .setKey("vpn_configurations")
                .setValueBundleArray(
                    ImmutableList.of(
                        new ManagedPropertyBundle().setManagedProperty(
                            ImmutableList.of(
                                new ManagedProperty()
                                    .setKey("server")
                                    .setValueString("http://vpn1.example.com"),
                                new ManagedProperty()
                                    .setKey("username")
                                    .setValueString("john.doe"))),
                        new ManagedPropertyBundle().setManagedProperty(
                            ImmutableList.of(
                                new ManagedProperty()
                                    .setKey("server")
                                    .setValueString("http://vpn2.example.com"),
                                new ManagedProperty()
                                    .setKey("username")
                                    .setValueString("jane.doe")))))));

    androidEnterprise.managedconfigurationsfordevice()
        .update(enterpriseId, userId, deviceId, managedConfigurationForDeviceId,
          managedConfiguration)
        .execute();

For more information on the different configuration properties that an app can support, see Define Managed Configurations.

List an app's configuration profiles

Depending on how you design your solution, you may want to display a list of saved configurations profiles for an app. To retrieve this list, call Managedconfigurationssettings.list.

Send feedback about...

Google Play EMM API