Devices

如需了解此资源的方法列表,请参阅本页结尾部分。

资源表示形式

设备资源表示由 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
  },
  "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 的控制。

可采用的值包括:
  • managedDevice”:将 EMM 的设备政策控制器 (DPC) 作为设备所有者的设备。
  • managedProfile”:一台设备同时拥有由 DPC(DPC 是个人资料所有者)管理的个人资料以及不适用于 DPC 的单独个人资料。
  • containerApp”,不再使用(已弃用)。
  • unmanagedProfile”:网域管理员已允许(通过管理控制台启用此权限)使用 Google Play 企业版的设备,但玩家资料本身不归 DPC 所有。


可接受的值:
  • "containerApp"
  • "managedDevice"
  • "managedProfile"
  • "unmanagedProfile"
model string 设备的型号名称。这条消息来自 android.os.Build.MODEL
policy nested object 在设备上强制执行的政策。
policy.autoUpdatePolicy string 控制何时可以应用设备上的应用自动更新。

推荐的替代方案:按应用设置 autoUpdateMode,在更新频率方面具有更大的灵活性。

如果将 autoUpdateMode 设置为 AUTO_UPDATE_POSTPONEDAUTO_UPDATE_HIGH_PRIORITYautoUpdatePolicy 将不会产生任何影响。

“choiceToTheUser”允许设备用户配置应用更新政策。“always”可启用自动更新。“never”将停用自动更新。“wifiOnly”仅会在设备连接到 WLAN 时启用自动更新。

可接受的值为:
  • "always"
  • "choiceToTheUser"
  • "never"
  • "wifiOnly"
policy.deviceReportPolicy string 指定设备是否向 EMM 报告应用状态。默认值为“deviceReportDisabled”。

可接受的值:
  • "deviceReportDisabled"
  • "deviceReportEnabled"
policy.maintenanceWindow nested object 维护窗口用于定义何时在前台运行的应用应更新。
policy.maintenanceWindow.durationMs long 维护窗口的时长(以毫秒为单位)。该时长必须介于 30 分钟到 24 小时(含 30 分钟)之间。
policy.maintenanceWindow.startTimeAfterMidnightMs long 设备维护期的开始时间(以毫秒为单位)。窗户可以跨越午夜。
policy.productAvailabilityPolicy string 针对指定产品授予设备的库存状况。“all”会授予设备对所有产品的访问权限,无论审批状态如何。选择“all”不会为“alpha”或“beta”轨道启用自动显示功能。“白名单”可向设备授予访问 productPolicy[] 中指定的产品的权限。只有获得批准的产品或之前已被企业批准的产品(即已被撤消审批的产品)才能列入白名单。如果未提供任何值,则默认应用在用户级设置的可用性。

可接受的值:
  • "all"
  • "whitelist"
policy.productPolicy[] list 产品政策列表。productAvailabilityPolicy 需要设置为 WHITELISTALL 才能应用产品政策。
policy.productPolicy[].autoInstallPolicy nested object 产品的自动安装政策。
policy.productPolicy[].autoInstallPolicy.autoInstallConstraint[] list 自动安装应用的限制条件。您最多可以指定一个限制条件。

policy.productPolicy[].autoInstallPolicy.autoInstallConstraint[].chargingStateConstraint string 充电状态限制。

可接受的值:
  • "chargingNotRequired"
  • "chargingRequired"
policy.productPolicy[].autoInstallPolicy.autoInstallConstraint[].deviceIdleStateConstraint string 设备空闲状态限制。

可接受的值:
  • "deviceIdleNotRequired"
  • "deviceIdleRequired"
policy.productPolicy[].autoInstallPolicy.autoInstallConstraint[].networkTypeConstraint string 网络类型限制条件。

可接受的值:
  • "anyNetwork"
  • "unmeteredNetwork"
policy.productPolicy[].autoInstallPolicy.autoInstallMode string 自动安装模式。如果未设置,则默认为“doNotAutoInstall”。无论设置维护期如何,应用都会自动安装应用。

可接受的值:
  • "autoInstallOnce"
  • "doNotAutoInstall"
  • "forceAutoInstall"
policy.productPolicy[].autoInstallPolicy.autoInstallPriority integer 安装优先级(以无符号整数表示)。数字越小,优先级越高。
policy.productPolicy[].autoInstallPolicy.minimumVersionCode integer 应用的最低版本。如果用户安装的是较低版本的应用,该应用将根据自动安装限制自动更新,而不是等待常规自动更新。您可以为每台设备最多 20 个应用设置最低版本代码。
policy.productPolicy[].autoUpdateMode string 产品的自动更新模式。使用 autoUpdateMode 时,它始终优先于用户的选择。因此,当用户手动更改设备设置时,系统会忽略这些更改。

可接受的值为:
  • "autoUpdateDefault"
  • "autoUpdateHighPriority"
  • "autoUpdatePostponed"
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 布尔值 - 仅当属性类型为布尔值时,此值才会显示。
policy.productPolicy[].managedConfiguration.managedProperty[].valueBundle nested object 受管理的房源包 - 此属性仅在房源类型为 bundle 时才会显示。
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 应用状态的严重性。此字段将始终显示。

可接受的值:
  • "severityError"
  • "severityInfo"
report.appState[].keyedAppState[].stateTimestampMillis long 应用设置状态时的时间戳(以自纪元以来的毫秒数表示)。此字段将始终显示。
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 中的帐号