有关此类资源的方法列表,请参阅本页面的结尾部分。
资源表示形式
“设备”资源表示由 EMM 管理且属于特定企业用户的移动设备。
{
  "kind": "androidenterprise#device",
  "androidId": string,
  "managementType": string,
  "policy": {
    "autoUpdatePolicy": string,
    "productAvailabilityPolicy": string,
    "productPolicy": [
      {
        "productId": string,
        "tracks": [
          string
        ],
        "trackIds": [
          string
        ],
        "managedConfiguration": {
          "kind": string,
          "productId": string,
          "managedProperty": [
            {
              "key": string,
              "valueBool": boolean,
              "valueInteger": integer,
              "valueString": string,
              "valueStringArray": [
                string
              ],
              "valueBundle": {
                "managedProperty": [
                  (ManagedProperty)
                ]
              },
              "valueBundleArray": [
                {
                  "managedProperty": [
                    (ManagedProperty)
                  ]
                }
              ]
            }
          ],
          "configurationVariables": {
            "kind": "androidenterprise#configurationVariables",
            "mcmId": string,
            "variableSet": [
              {
                "kind": "androidenterprise#variableSet",
                "placeholder": string,
                "userValue": string
              }
            ]
          }
        },
        "autoInstallPolicy": {
          "autoInstallMode": string,
          "autoInstallPriority": integer,
          "autoInstallConstraint": [
            {
              "networkTypeConstraint": string,
              "chargingStateConstraint": string,
              "deviceIdleStateConstraint": string
            }
          ],
          "minimumVersionCode": integer
        },
        "autoUpdateMode": string,
        "enterpriseAuthenticationAppLinkConfigs": [
          {
            "uri": string
          }
        ]
      }
    ],
    "maintenanceWindow": {
      "startTimeAfterMidnightMs": long,
      "durationMs": long
    },
    "deviceReportPolicy": string,
    "policyId": string
  },
  "report": {
    "lastUpdatedTimestampMillis": long,
    "appState": [
      {
        "packageName": string,
        "keyedAppState": [
          {
            "key": string,
            "stateTimestampMillis": long,
            "severity": string,
            "message": string,
            "data": string
          }
        ]
      }
    ]
  },
  "latestBuildFingerprint": string,
  "sdkVersion": integer,
  "maker": string,
  "model": string,
  "device": string,
  "product": string,
  "retailBrand": string
}| 属性名称 | 值 | 说明 | 备注 | 
|---|---|---|---|
androidId | 
        string | 
        设备的 Google Play 服务 Android ID,编码为小写十六进制字符串。例如 "123456789abcdef0"。 | 
        |
device | 
        string | 
        设备的内部硬件代码名称。此信息来自 android.os.Build.DEVICE。(logs/wireless/android/android_checkin.proto 中名为“device”的字段) | 
        |
kind | 
        string | 
        ||
latestBuildFingerprint | 
        string | 
        设备的 build 指纹(如果已知)。 | |
maker | 
        string | 
        设备的制造商。此信息来自 android.os.Build.MANUFACTURER。 | 
        |
managementType | 
        string | 
        用于确定在各种部署配置中,设备受托管 Google Play EMM 控制的程度。 可能的值包括: 
 可接受的值: 
  | 
        |
model | 
        string | 
        设备的型号名称。此信息来自 android.os.Build.MODEL。 | 
        |
policy | 
        nested object | 
        在设备上强制执行的政策。 | |
policy.autoUpdatePolicy | 
        string | 
        控制何时可以在设备上应用自动应用更新。 建议的替代方案:按应用进行设置的 autoUpdateMode,可在更新频率方面更灵活。将 autoUpdateMode 设置为 AUTO_UPDATE_POSTPONED 或 AUTO_UPDATE_HIGH_PRIORITY 时,autoUpdatePolicy 不会产生任何影响。
 可接受的值包括: 
  | 
        |
policy.deviceReportPolicy | 
        string | 
        设备是否向 EMM 报告应用状态。默认值为“deviceReportDisabled”。
           可接受的值包括: 
  | 
        |
policy.maintenanceWindow | 
        nested object | 
        维护窗口,用于定义应更新在前台运行的应用何时应更新。 | |
policy.maintenanceWindow.durationMs | 
        long | 
        维护窗口的时长(以毫秒为单位)。时长必须介于 30 分钟到 24 小时(含)之间。 | |
policy.maintenanceWindow.startTimeAfterMidnightMs | 
        long | 
        维护窗口的开始时间(以设备上的午夜零点后经过的毫秒数表示)。时间范围可以跨越午夜。 | |
policy.policyId | 
        string | 
        政策的标识符,将随从 Play 商店发送的应用安装反馈一起传递。 | |
policy.productAvailabilityPolicy | 
        string | 
        为指定产品向设备授予的播放权限。无论审批状态如何,“all”都允许设备访问所有产品。“全部”不会自动公开“Alpha”或“Beta”轨道。“whitelist”会授予设备对 productPolicy[] 中指定产品的访问权限。只有已获企业批准的产品或之前获得批准的产品(已撤消批准的产品)才能列入白名单。如果未提供任何值,系统会默认应用在用户级别设置的可用性。
           可接受的值包括: 
  | 
        |
policy.productPolicy[] | 
        list | 
        产品政策列表。productAvailabilityPolicy 需要设置为 WHITELIST 或 ALL,才能应用商品政策。 | 
        |
policy.productPolicy[].autoInstallPolicy | 
        nested object | 
        产品的自动安装政策。 | |
policy.productPolicy[].autoInstallPolicy.autoInstallConstraint[] | 
        list | 
        自动安装应用的限制条件。您最多可以指定一个限制条件。 | 
        |
policy.productPolicy[].autoInstallPolicy.autoInstallConstraint[].chargingStateConstraint | 
        string | 
        充电状态约束条件。
           可接受的值包括: 
  | 
        |
policy.productPolicy[].autoInstallPolicy.autoInstallConstraint[].deviceIdleStateConstraint | 
        string | 
        设备空闲状态约束条件。
           可接受的值包括: 
  | 
        |
policy.productPolicy[].autoInstallPolicy.autoInstallConstraint[].networkTypeConstraint | 
        string | 
        网络类型约束条件。
           可接受的值包括: 
  | 
        |
policy.productPolicy[].autoInstallPolicy.autoInstallMode | 
        string | 
        自动安装模式。如果未设置,则默认为“doNotAutoInstall”。无论是否设置了维护窗口,系统都会自动安装应用。
           可接受的值包括: 
  | 
        |
policy.productPolicy[].autoInstallPolicy.autoInstallPriority | 
        integer | 
        安装的优先级,以无符号整数表示。数字越小,优先级越高。 | |
policy.productPolicy[].autoInstallPolicy.minimumVersionCode | 
        integer | 
        应用的最低版本。如果安装的应用版本较低,则系统会根据自动安装约束条件自动更新应用,而不是等待常规自动更新。您最多可以为每部设备的 20 个应用设置最低版本代码。 | |
policy.productPolicy[].autoUpdateMode | 
        string | 
        商品的自动更新模式。使用 autoUpdateMode 时,它始终优先于用户的选择。因此,当用户手动更改设备设置时,系统会忽略这些更改。
          可接受的值: 
  | 
        |
policy.productPolicy[].enterpriseAuthenticationAppLinkConfigs[] | 
        list | 
        身份提供方的身份验证器应用的身份验证网址配置。这有助于在使用 Android WebView 的专用应用中进行身份验证期间启动身份提供方的身份验证器应用。身份验证器应用应已成为设备上身份验证网址的 默认处理程序。 | |
policy.productPolicy[].enterpriseAuthenticationAppLinkConfigs[].uri | 
        string | 
        身份验证网址。 | |
policy.productPolicy[].managedConfiguration | 
        nested object | 
        产品的受管理配置。 | |
policy.productPolicy[].managedConfiguration.configurationVariables | 
        nested object | 
        包含受管理的配置文件的 ID 以及为用户定义的一组配置变量(如果有)。 | |
policy.productPolicy[].managedConfiguration.configurationVariables.kind | 
        string | 
        ||
policy.productPolicy[].managedConfiguration.configurationVariables.mcmId | 
        string | 
        受管配置设置的 ID。 | |
policy.productPolicy[].managedConfiguration.configurationVariables.variableSet[] | 
        list | 
        归因于用户的变量集。 | |
policy.productPolicy[].managedConfiguration.configurationVariables.variableSet[].kind | 
        string | 
        ||
policy.productPolicy[].managedConfiguration.configurationVariables.variableSet[].placeholder | 
        string | 
        占位符字符串;由 EMM 定义。 | |
policy.productPolicy[].managedConfiguration.configurationVariables.variableSet[].userValue | 
        string | 
        占位符的值,因用户而异。 | |
policy.productPolicy[].managedConfiguration.kind | 
        string | 
        已废弃。 | 
        |
policy.productPolicy[].managedConfiguration.managedProperty[] | 
        list | 
        此配置的一组托管媒体资源。 | |
policy.productPolicy[].managedConfiguration.managedProperty[].key | 
        string | 
        用于标识媒体资源的唯一键。 | |
policy.productPolicy[].managedConfiguration.managedProperty[].valueBool | 
        boolean | 
        布尔值 - 只有当属性的类型为 bool 时,此值才会存在。 | |
policy.productPolicy[].managedConfiguration.managedProperty[].valueBundle | 
        nested object | 
        受管媒体资源的软件包 - 只有当媒体资源的类型为软件包时,此属性才会存在。 | |
policy.productPolicy[].managedConfiguration.managedProperty[].valueBundle.managedProperty[] | 
        list | 
        受管理资源的列表。 | |
policy.productPolicy[].managedConfiguration.managedProperty[].valueBundleArray[] | 
        list | 
        属性的软件包列表 - 只有当属性的类型为 bundle_array 时,才会存在。 | |
policy.productPolicy[].managedConfiguration.managedProperty[].valueBundleArray[].managedProperty[] | 
        list | 
        受管理媒体资源的列表。 | |
policy.productPolicy[].managedConfiguration.managedProperty[].valueInteger | 
        integer | 
        整数值 - 仅当属性的类型为整数时才存在。 | |
policy.productPolicy[].managedConfiguration.managedProperty[].valueString | 
        string | 
        字符串值 - 仅当属性类型为字符串、选项或隐藏时,此字段才会显示。 | |
policy.productPolicy[].managedConfiguration.managedProperty[].valueStringArray[] | 
        list | 
        字符串值列表 - 只有当属性类型为多选时,此字段才会出现。 | |
policy.productPolicy[].managedConfiguration.productId | 
        string | 
        受管配置所针对的产品的 ID,例如“app:com.google.android.gm”。 | |
policy.productPolicy[].productId | 
        string | 
        商品的 ID。例如 "app:com.google.android.gm"。 | 
        |
policy.productPolicy[].trackIds[] | 
        list | 
        向设备授予对指定产品发布轨道的公开范围(由 trackIds 标识)。您可以通过调用 Products.Get 获取商品的发布轨道列表。 | 
        |
policy.productPolicy[].tracks[] | 
        list | 
        已弃用。请改用 trackIds。 | 
        |
product | 
        string | 
        设备的商品名称。此信息来自 android.os.Build.PRODUCT。 | 
        |
report | 
        nested object | 
        使用最新应用状态更新的设备报告。 | |
report.appState[] | 
        list | 
        设备上受管理应用设置的应用状态列表。应用状态由应用开发者定义。此字段将始终存在。 | |
report.appState[].keyedAppState[] | 
        list | 
        键值对应用状态的列表。此字段将始终存在。 | |
report.appState[].keyedAppState[].data | 
        string | 
        用于输入机器可读数据的额外字段。例如,数字或 JSON 对象。为防止 XSS 攻击,我们建议您在显示数据之前从中移除所有 HTML。 | |
report.appState[].keyedAppState[].key | 
        string | 
        用于指明应用为何提供状态的键。键的内容由应用开发者设置。为防止 XSS,我们建议先从键中移除任何 HTML,然后再显示该键。此字段将始终存在。 | |
report.appState[].keyedAppState[].message | 
        string | 
        用于描述应用状态的自由形式、直观易懂的消息。例如一条错误消息。为防止 XSS 攻击,我们建议您在显示消息之前从中移除所有 HTML。 | |
report.appState[].keyedAppState[].severity | 
        string | 
        应用状态的严重程度。此字段将始终存在。
           可接受的值包括: 
  | 
        |
report.appState[].keyedAppState[].stateTimestampMillis | 
        long | 
        应用设置状态时的时间戳(以毫秒为单位,从 Epoch 起算)。此字段将始终存在。 | |
report.appState[].packageName | 
        string | 
        应用的软件包名称。此字段将始终显示。 | |
report.lastUpdatedTimestampMillis | 
        long | 
        上次报告更新的时间戳(以自纪元以来经过的毫秒数表示)。此字段将始终存在。 | |
retailBrand | 
        string | 
        设备的零售品牌(如果已设置)。请参阅 android.os.Build.BRAND。 | 
        |
sdkVersion | 
        integer | 
        API 兼容性版本。 | 
方法
- forceReportUpload
 - 上传一份报告,其中包含自上次生成报告以来设备上应用状态发生的任何变化。对于给定设备,您每 24 小时最多可以调用此方法 3 次。
 - get
 - 检索设备的详细信息。
 - getState
 - 检索设备对 Google 服务的访问权限是启用还是停用。只有在 Google 管理控制台中启用了“在 Android 设备上强制执行 EMM 政策”后,设备状态才会生效。否则,系统会忽略设备状态,并允许所有设备访问 Google 服务。只有由 Google 管理的用户支持此设置。
 - list
 - 检索用户所有设备的 ID。
 - setState
 - 设置设备对 Google 服务的访问权限是启用还是停用。只有在 Google 管理控制台中启用了“在 Android 设备上强制执行 EMM 政策”后,设备状态才会生效。否则,系统会忽略设备状态,并允许所有设备访问 Google 服务。只有 Google 管理的用户支持此功能。
 - update
 - 更新设备政策。
为确保正确强制执行此政策,您需要在 Google Play 软件包的受管理配置中设置allowed_accounts,以阻止非受管账号访问 Google Play。请参阅在 Google Play 中限制账号。