拉取并返回与为请求进行身份验证的服务账号关联的企业的通知集。如果没有待处理的通知,通知集可能会为空。
返回的通知集需要在 20 秒内通过调用 Enterprises.AcknowledgeNotificationSet 进行确认,除非通知集为空。
如果未在 20 秒内确认通知,系统最终会在对另一个 PullNotificationSet 请求的响应中再次包含该通知;如果从未确认通知,系统最终会根据 Google Cloud Platform Pub/Sub 系统政策将其删除。
系统可能会并发执行多个请求来检索通知,在这种情况下,待处理的通知(如果有)将分布在每个调用方之间(如果有)。
如果没有通知,则返回空通知列表。后续请求可能会在有更多通知可用时返回更多通知。
请求
HTTP 请求
POST https://www.googleapis.com/androidenterprise/v1/enterprises/pullNotificationSet
参数
| 参数名称 | 值 | 说明 | 
|---|---|---|
| 可选的查询参数 | ||
| requestMode | string | 用于拉取通知的请求模式。 指定 waitForNotifications会导致请求阻塞并等待出现一个或多个通知,如果在过了一段时间后没有任何通知,则返回一个空通知列表。指定 returnImmediately会导致请求立即返回待处理的通知,如果没有通知,则返回空列表。如果省略,则默认为 waitForNotifications。可接受的值: 
 | 
授权
此请求需要获得以下范围的授权:
| 范围 | 
|---|
| https://www.googleapis.com/auth/androidenterprise | 
如需了解详情,请参阅身份验证和授权页面。
请求正文
使用此方法时请勿提供请求正文。
响应
如果成功,此方法将返回采用以下结构的响应正文:
{
  "kind": "androidenterprise#notificationSet",
  "notificationSetId": string,
  "notification": [
    {
      "enterpriseId": string,
      "timestampMillis": long,
      "notificationType": string,
      "productApprovalEvent": {
        "productId": string,
        "approved": string
      },
      "installFailureEvent": {
        "productId": string,
        "deviceId": string,
        "userId": string,
        "failureReason": string,
        "failureDetails": string
      },
      "appUpdateEvent": {
        "productId": string
      },
      "newPermissionsEvent": {
        "productId": string,
        "requestedPermissions": [
          string
        ],
        "approvedPermissions": [
          string
        ]
      },
      "appRestrictionsSchemaChangeEvent": {
        "productId": string
      },
      "productAvailabilityChangeEvent": {
        "productId": string,
        "availabilityStatus": string
      },
      "newDeviceEvent": {
        "userId": string,
        "deviceId": string,
        "managementType": string,
        "dpcPackageName": string
      },
      "deviceReportUpdateEvent": {
        "userId": string,
        "deviceId": string,
        "report": {
          "lastUpdatedTimestampMillis": long,
          "appState": [
            {
              "packageName": string,
              "keyedAppState": [
                {
                  "key": string,
                  "stateTimestampMillis": long,
                  "severity": string,
                  "message": string,
                  "data": string
                }
              ]
            }
          ]
        }
      },
      "enterpriseUpgradeEvent": {
        "upgradeState": string
      }
    }
  ]
}| 属性名称 | 值 | 说明 | 备注 | 
|---|---|---|---|
| notificationSetId | string | 通知集 ID,需要使用 Enterprises.AcknowledgeNotification API 将通知标记为已收到。如果没有通知,则会省略此字段。 | |
| notification[] | list | 收到的通知;如果没有收到通知,则为空。 | |
| notification[].enterpriseId | string | 要为其发送通知的企业的 ID。此字段始终存在。 | |
| notification[].timestampMillis | long | 通知的发布时间(以毫秒为单位,自 1970-01-01T00:00:00Z 开始)。此字段始终存在。 | |
| notification[].productApprovalEvent | nested object | 有关商品审批状态变更的通知。 | |
| notification[].productApprovalEvent.productId | string | 审批状态发生变化的商品的 ID(例如“app:com.google.android.gm”)。此字段始终存在。 | |
| notification[].productApprovalEvent.approved | string | 商品是已获批准还是未获批准。此字段将始终存在。 可接受的值包括: 
 | |
| notification[].installFailureEvent | nested object | 有关应用安装失败的通知。 | |
| notification[].installFailureEvent.productId | string | 发生安装失败事件的产品的 ID(例如“app:com.google.android.gm”)。此字段始终存在。 | |
| notification[].installFailureEvent.deviceId | string | 设备的 Android ID。此字段将始终存在。 | |
| notification[].installFailureEvent.userId | string | 用户的 ID。此字段始终存在。 | |
| notification[].installFailureEvent.failureReason | string | 安装失败的原因。此字段将始终存在。 可接受的值包括: 
 | |
| notification[].installFailureEvent.failureDetails | string | 有关失败的其他详细信息(如果适用)。 | |
| notification[].appUpdateEvent | nested object | 有关应用更新的通知。 | |
| notification[].appUpdateEvent.productId | string | 更新的商品的 ID(例如“app:com.google.android.gm”)。此字段将始终存在。 | |
| notification[].newPermissionsEvent | nested object | 有关新应用权限的通知。 | |
| notification[].newPermissionsEvent.productId | string | 添加了新权限的商品的 ID(例如“app:com.google.android.gm”)。此字段将始终存在。 | |
| notification[].newPermissionsEvent.requestedPermissions[] | list | 应用当前请求的一组权限。您可以使用 EMM API 中的 Permissions.Get 检索这些权限的详细信息。 | |
| notification[].newPermissionsEvent.approvedPermissions[] | list | 企业管理员已为此应用批准的一组权限。您可以使用 EMM API 中的 Permissions.Get 检索这些权限的详细信息。 | |
| notification[].appRestrictionsSchemaChangeEvent | nested object | 有关新的应用限制架构变更的通知。 | |
| notification[].appRestrictionsSchemaChangeEvent.productId | string | 应用限制架构发生更改的商品的 ID(例如“app:com.google.android.gm”)。此字段将始终存在。 | |
| notification[].productAvailabilityChangeEvent | nested object | 有关商品库存状况变化的通知。 | |
| notification[].productAvailabilityChangeEvent.productId | string | 商品库存状况发生变化的商品的 ID(例如“app:com.google.android.gm”)。此字段将始终存在。 | |
| notification[].productAvailabilityChangeEvent.availabilityStatus | string | 商品的新状态。此字段将始终存在。 可接受的值包括: 
 | |
| notification[].newDeviceEvent | nested object | 有关新设备的通知。 | |
| notification[].newDeviceEvent.userId | string | 用户的 ID。此字段始终存在。 | |
| notification[].newDeviceEvent.deviceId | string | 设备的 Android ID。此字段将始终存在。 | |
| notification[].newDeviceEvent.managementType | string | 确定在各种部署配置中,设备受 Android EMM 控制的程度。 可能的值包括: 
 可接受的值: 
 | |
| notification[].notificationType | string | 通知的类型。 可接受的值包括: 
 | |
| notification[].newDeviceEvent.dpcPackageName | string | 设备上的政策应用。 | |
| notification[].deviceReportUpdateEvent | nested object | 有关设备报告更新的通知。 | |
| notification[].deviceReportUpdateEvent.userId | string | 用户的 ID。此字段始终存在。 | |
| notification[].deviceReportUpdateEvent.deviceId | string | 设备的 Android ID。此字段始终存在。 | |
| notification[].deviceReportUpdateEvent.report | nested object | 设备报告已更新为包含最新的应用状态。此字段始终存在。 | |
| notification[].deviceReportUpdateEvent.report.lastUpdatedTimestampMillis | long | 上次报告更新的时间戳(以自纪元以来经过的毫秒数表示)。此字段始终存在。 | |
| notification[].deviceReportUpdateEvent.report.appState[] | list | 设备上受管理应用设置的应用状态列表。应用状态由应用开发者定义。此字段将始终存在。 | |
| notification[].deviceReportUpdateEvent.report.appState[].packageName | string | 应用的软件包名称。此字段始终存在。 | |
| notification[].deviceReportUpdateEvent.report.appState[].keyedAppState[] | list | 键值对应用状态的列表。此字段将始终存在。 | |
| notification[].deviceReportUpdateEvent.report.appState[].keyedAppState[].key | string | 用于指明应用要为哪些内容提供状态的键。键的内容由应用开发者设置。为防止 XSS 攻击,我们建议您在显示密钥之前从中移除所有 HTML。此字段始终存在。 | |
| notification[].deviceReportUpdateEvent.report.appState[].keyedAppState[].stateTimestampMillis | long | 应用设置状态的时间戳(以从公元纪年开始计算的毫秒数表示)。此字段始终存在。 | |
| notification[].deviceReportUpdateEvent.report.appState[].keyedAppState[].severity | string | 应用状态的严重程度。此字段将始终存在。 可接受的值包括: 
 | |
| notification[].deviceReportUpdateEvent.report.appState[].keyedAppState[].message | string | 用于描述应用状态的自由形式、直观易懂的消息。例如,错误消息。为防止 XSS 攻击,我们建议您在显示消息之前从中移除所有 HTML。 | |
| notification[].deviceReportUpdateEvent.report.appState[].keyedAppState[].data | string | 用于机器可读数据的附加字段。例如,数字或 JSON 对象。为防止 XSS 攻击,我们建议您在显示数据之前从中移除所有 HTML。 | |
| kind | string | ||
| notification[].enterpriseUpgradeEvent | nested object | 有关企业版升级的通知。 | |
| notification[].enterpriseUpgradeEvent.upgradeState | string | 升级状态。 可接受的值包括: 
 |