{"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 host","restrictionType":"string"},{"key":"username","title":"VPN account username","restrictionType":"string"}]}]}]}
指定受管配置
对于支持托管配置的应用,您可以允许 IT 管理员进行设置
从 EMM 控制台嵌入受管配置 iframe 或通过
开发自己的界面
方法 1:嵌入受管配置 iframe
要支持托管配置,最简单的方法就是在
将配置 iframe 复制到 EMM 控制台中。iframe 会检索托管
配置架构,并允许 IT 管理员保存、修改
和删除自定义配置文件您可以使用 Play EMM API
自定义个人资料与用户设备相关联。要详细了解 iframe 以及如何添加 iframe,
请参阅
受管配置 iframe。
方法 2:创建自己的界面
使用从 Products.getAppRestrictionsSchema 返回的配置,
可以创建自己的界面,供 IT 管理员管理应用配置。
应用受管配置
如需将受管配置应用于设备,必须集成您的 DPC
使用 DPC 支持库,详见构建设备政策
控制器。
DPC 支持库
以透明的方式处理向 Google Play 授予的委托,以应用受管理的
配置。
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("vpn1.example.com"),
new ManagedProperty()
.setKey("username")
.setValueString("john.doe"))),
new ManagedPropertyBundle().setManagedProperty(
ImmutableList.of(
new ManagedProperty()
.setKey("server")
.setValueString("vpn2.example.com"),
new ManagedProperty()
.setKey("username")
.setValueString("jane.doe")))))));
[[["易于理解","easyToUnderstand","thumb-up"],["解决了我的问题","solvedMyProblem","thumb-up"],["其他","otherUp","thumb-up"]],[["没有我需要的信息","missingTheInformationINeed","thumb-down"],["太复杂/步骤太多","tooComplicatedTooManySteps","thumb-down"],["内容需要更新","outOfDate","thumb-down"],["翻译问题","translationIssue","thumb-down"],["示例/代码问题","samplesCodeIssue","thumb-down"],["其他","otherDown","thumb-down"]],["最后更新时间 (UTC):2025-07-26。"],[[["\u003cp\u003eEnterprise apps can have managed configurations that IT admins can remotely set to control app behavior, like enabling Wi-Fi-only data sync.\u003c/p\u003e\n"],["\u003cp\u003eUse the \u003ccode\u003eProducts.getAppRestrictionsSchema\u003c/code\u003e API to check if an app supports managed configurations and to retrieve its configuration schema.\u003c/p\u003e\n"],["\u003cp\u003eIT admins can set configurations via an embedded iframe or a custom UI developed using the configuration schema.\u003c/p\u003e\n"],["\u003cp\u003eApplying configurations requires DPC integration and can be done using an \u003ccode\u003emcmId\u003c/code\u003e from the iframe or a list of managed properties.\u003c/p\u003e\n"],["\u003cp\u003eThe \u003ccode\u003eManagedconfigurationssettings.list\u003c/code\u003e API can retrieve a list of saved configuration profiles for an app, if supported.\u003c/p\u003e\n"]]],[],null,["# Configure apps\n\nSome apps designed for enterprises include built-in settings called **managed\nconfigurations** that IT admins can configure remotely. For example, an app may\nhave the option to only sync data when a device is connected to Wi-Fi. Providing\nIT admins the ability to specify managed configurations and apply them to\ndevices is a requirement for all [solution sets](/android/work/requirements).\n\nThe diagram below illustrates some of the key stages of managed configuration\nmanagement with an overview of the options available through the Google Play EMM\nAPI.\n\nCheck if an app supports managed configurations\n-----------------------------------------------\n\nUse\n[`Products.getAppRestrictionsSchema`](https://developers.google.com/android/work/play/emm-api/v1/products/getAppRestrictionsSchema)\nto determine whether an app supports managed configurations. Here's an example\nthat uses the\n[Google Play EMM API Client Library for Java](/api-client-library/java/apis/androidenterprise/v1). \n\n public AppRestrictionsSchema getAppRestrictionsSchema(String enterpriseId,\n String productId, String language) throws IOException {\n return androidEnterprise\n .product()\n .getAppRestrictionsSchema(enterpriseId, productId, language)\n .execute();\n }\n\nAll apps return an app restrictions (managed configurations) schema. If the call\nreturns an empty schema, then the app doesn't support manage configurations. If\nthe call returns a schema containing a set of restrictions, then the app\nsupports managed configurations. For example, an app that has a property for\nenabling remote printing over a VPN could return the following response to\n`Products.getAppRestrictionsSchema`. \n\n {\n \"kind\": \"androidenterprise#appRestrictionsSchema\",\n \"restrictions\": [\n {\n \"key\": \"printing_enabled\",\n \"title\": \"Enable printing\",\n \"restrictionType\": \"bool\",\n \"description\": \"Allow user to print from the app\",\n \"defaultValue\": {\n \"type\": \"bool\",\n \"valueBool\": true,\n }\n },\n {\n \"key\": \"vpn_configurations\",\n \"title\": \"VPN configurations\",\n \"restrictionType\": \"bundle_array\",\n \"description\": \"List of VPN configurations\",\n \"nestedRestriction\": [\n {\n \"key\": \"vpn_configuration\",\n \"title\": \"VPN configuration\",\n \"restrictionType\": \"bundle\",\n \"nestedRestrictions\": [\n {\n \"key\": \"server\",\n \"title\": \"VPN server host\",\n \"restrictionType\": \"string\"\n },\n {\n \"key\": \"username\",\n \"title\": \"VPN account username\",\n \"restrictionType\": \"string\"\n }\n ]\n }\n ]\n }\n ]\n }\n\nSpecify managed configurations\n------------------------------\n\nFor apps that support managed configurations, you can enable IT admins to set\nthem from your EMM console by embedding the managed configurations iframe or by\ndeveloping your own UI.\n\n### Option 1: Embed the managed configurations iframe\n\nThe easiest way to support managed configurations is to embed the managed\nconfigurations iframe into your EMM console. The iframe retrieves the managed\nconfigurations schema for a specified app, and allows IT admins to save, edit,\nand delete custom configuration profiles. You can use the Play EMM API to apply\ncustom profiles to user's devices. To learn more about the iframe and how to add\nit to your console, see\n[managed configurations iframe](/android/work/play/emm-api/managed-configurations-iframe).\n\n### Option 2: Create your own UI\n\nUsing the configurations returned from `Products.getAppRestrictionsSchema`, you\ncan create your own UI that allows IT admins to manage app configurations.\n\nApply managed configurations\n----------------------------\n\n| **Note:** You can only apply managed configurations to apps published to production. Managed configurations are not compatible with apps distributed to [closed\n| tracks](/android/work/play/emm-api/distribute#distribute_apps_for_closed_testing).\n\nIn order to apply managed configurations to devices, your DPC must be integrated\nwith the DPC Support Library, as detailed in [Build a device policy\ncontroller](https://developer.android.com/work/dpc/build-dpc.html).\nThe [DPC Support Library](/android/work/dpc/build-dpc#dpc_support_library)\ntransparently handles the delegation to Google Play to apply managed\nconfigurations.\n\nYou can apply managed configurations to a device by setting\n`policy.productPolicy.managedConfiguration` in the\n[`Device`](/android/work/play/emm-api/v1/devices)'s `policy`.\n\n### Using an mcmId\n\n| **Note:** This option is only available if you support the [managed configurations\n| iframe](/android/work/play/emm-api/managed-configurations-iframe).\n\nEach time an IT admin saves a new configuration profile from the managed\nconfigurations iframe, the iframe returns a unique identifier called `mcmId`. An\n`mcmId` has no limit on the number of devices it can be applied on and it does\nnot have an expiration time.\n\nTo apply a configuration profile to a device, set\n`policy.productPolicy.managedConfiguration.configurationVariables.mcmId` in the\n[`Device`](/android/work/play/emm-api/v1/devices)'s `policy`.\n\nIf you want to allow your IT admins to use variable in the managed\nconfigurations iframe (such as $FirstName, $LastName), you need to define any\nvariables contained in the profile using\n`policy.productPolicy[].managedConfiguration.configurationVariables.mcmId.variableSet[]`.\n\n### Using a list of managed properties\n\nYou can also include a set of managed properties by setting\n`policy.productPolicy.managedConfiguration.managedProperty[]` in the\n[`Device`](/android/work/play/emm-api/v1/devices)'s `policy`.\n\nThe example below shows how to define a configuration. This configuration\ncontains a `bundle_array` (a list) that's made up of two bundle properties (a\ngroup of related properties, in this case, properties for a VPN). \n\n ManagedConfiguration managedConfiguration = new ManagedConfiguration()\n .setManagedProperty(\n ImmutableList.of(\n new ManagedProperty()\n .setKey(\"printing_enabled\")\n .setValueBool(true),\n new ManagedProperty()\n .setKey(\"vpn_configurations\")\n .setValueBundleArray(\n ImmutableList.of(\n new ManagedPropertyBundle().setManagedProperty(\n ImmutableList.of(\n new ManagedProperty()\n .setKey(\"server\")\n .setValueString(\"vpn1.example.com\"),\n new ManagedProperty()\n .setKey(\"username\")\n .setValueString(\"john.doe\"))),\n new ManagedPropertyBundle().setManagedProperty(\n ImmutableList.of(\n new ManagedProperty()\n .setKey(\"server\")\n .setValueString(\"vpn2.example.com\"),\n new ManagedProperty()\n .setKey(\"username\")\n .setValueString(\"jane.doe\")))))));\n\n| **Note:** `bundle_array` and `bundle` are only supported on Android 6.0+. Google Play silently drops these properties on older versions of Android. As an EMM provider, you should inform administrators about this constraint if there are any Android 5.0 (or below) devices in their environment.\n\nFor more information on the different configuration properties that an app can\nsupport, see [Define Managed\nConfigurations](https://developer.android.com/work/managed-configurations.html#define-configuration).\n\nList an app's configuration profiles\n------------------------------------\n\n| **Note:** This feature is only available if you support the [managed configurations iframe](/android/work/play/emm-api/managed-configurations-iframe).\n\nDepending on how you design your solution, you may want to display a list of\nsaved configurations profiles for an app. To retrieve this list, call\n[`Managedconfigurationssettings.list`](/android/work/play/emm-api/v1/managedconfigurationssettings)."]]