重要資訊:我們目前不接受新的 Play EMM API 註冊。
瞭解詳情。
設定 EMM 通知
透過集合功能整理內容
你可以依據偏好儲存及分類內容。
Google Play 會針對影響企業的各種事件產生通知,這類通知稱為「EMM 通知」。舉例來說,當應用程式獲得核准時,系統會傳送 ProductApprovalEvent
通知。
EMM 通知會與特定企業服務帳戶 (ESA)相關聯。身為 EMM,您可以設定控制台,讓系統根據收到的通知,向企業 IT 管理員顯示警報或訊息。
使用 Google Cloud Pub/Sub 傳送 EMM 通知。如要進一步瞭解如何設定 Pub/Sub 通知,請參閱訂閱者總覽和提取訂閱者指南。
如要確認系統已成功設定為接收 Google Play 的 EMM 通知,並擷取需要連結訂閱項目的 Cloud Pub/Sub 主題名稱,請呼叫 Enterprises.sendTestPushNotification
。
傳送測試通知,即可驗證企業行動管理服務與 Google Cloud Pub/Sub 服務的整合情形。如果 EMM 通知設定正確,API 會傳回以下內容:
{
topic_name: "/projects/project-name/topics/play-work-012345",
message_id: "128976912439"
}
拉取通知
Google Cloud Pub/Sub 支援兩種不同的通知機制:提取和推送。不過,我們建議您只使用拉取通知。使用提取方法不需要設定任何外部伺服器,且可搭配以程式設計方式建立的 ESA 和手動建立的 ESA 使用。提取通知的另一個優點是,客戶幾乎不需要額外設定或維護。請使用 Enterprises.pullNotificationSet
和 Enterprises.acknowledgeNotificationSet
,透過長時間運行的傳出連線接收及確認 EMM 通知。
呼叫 Enterprises.pullNotificationSet
時,建議將 requestMode
設為預設值 (waitForNotifications
)。這樣一來,要求會等到出現一或多則通知,再傳回回應。如果一段時間後沒有任何通知,要求會傳回空的通知清單,您可以嘗試再次提出要求。
收到通知後,請呼叫 Enterprises.acknowledgeNotificationSet
,確保下次呼叫 Enterprises.pullNotificationSet
時不會傳回相同的通知。
您也可以在呼叫 Enterprises.pullNotificationSet
時將 requestMode
設為 returnImmediately
。您會立即收到要求的回應,其中包含任何待處理的通知,如果沒有通知,則會收到空白清單。您初次測試通知導入作業時,可能會需要使用這個 requestMode
選項。
EMM 通知範例
以下列舉一些事件和事件產生的通知類型:
注意:下列通知類型已淘汰:ProductApprovalEvent
、AppUpdateEvent
、NewPermissionsEvent
、AppRestrictionsSchemaChangeEvent
、ProductAvailabilityChangeEvent
和 NewDeviceEvent
。針對 AppUpdateEvent
,您必須按照我們的建議使用 高優先順序更新模式 。
說明 | 通知 |
透過
Google Play EMM API 要求測試通知。您需要傳送測試通知,確認系統可以接收 Google Play 發布的通知,並瞭解與 Google Play 相關聯的所有通知所使用的主題名稱。 | TestPushNotification |
新提供的裝置已準備就緒,可由 Google Play EMM API 管理。您現在可以呼叫需要裝置 deviceId (例如 Installs) 的 API,以及傳回 Devices 資源的 API。只有在受管理裝置上設定第一個帳戶後,系統才會傳送這則通知。已淘汰
| NewDeviceEvent |
管理員會在 Google Play 管理版控制台將應用程式標示為已核准或未核准。已淘汰
| ProductApprovalEvent
|
裝置的待安裝作業逾時。舉例來說,系統已接受推送安裝要求,但裝置在幾天內無法連線,因此無法確認安裝作業。系統會傳送安裝逾時通知。 | InstallFailureEvent
|
應用程式已發布新版本。更新可供一或多部裝置使用,但不一定適用於所有裝置。已淘汰
| AppUpdateEvent
|
應用程式更新需要新的權限才能獲得管理員核准,才能進行更新或新安裝作業。如果應用程式接受的權限組合與應用程式要求的權限組合不同,系統就會傳送這則通知。已淘汰
| NewPermissionsEvent |
發布新版應用程式,其中包含新的或修改過的受管理設定結構定義。開發人員上傳新 APK 時,Google Play 會將資訊清單中的結構定義與應用程式先前版本中的結構定義進行比較。如果結構定義已變更,系統會通知已核准應用程式的企業。已淘汰 |
AppRestrictionsSchemaChangeEvent |
可用的應用程式變成無法使用,或是無法使用的應用程式重新加入 Google Play。如果開發人員取消發布應用程式,或是應用程式從 Google Play 下架,應用程式可用性就會有所變動。如果未開放的應用程式重新加入 Google Play,供應情形也會隨之變更。已淘汰
|
ProductAvailabilityChangeEvent |
與企業升級相關的通知。企業升級是將 Google Play 管理版帳戶企業升級為 Google 管理版網域的程序。 |
EnterpriseUpgradeEvent |
除非另有註明,否則本頁面中的內容是採用創用 CC 姓名標示 4.0 授權,程式碼範例則為阿帕契 2.0 授權。詳情請參閱《Google Developers 網站政策》。Java 是 Oracle 和/或其關聯企業的註冊商標。
上次更新時間:2025-08-31 (世界標準時間)。
[null,null,["上次更新時間:2025-08-31 (世界標準時間)。"],[[["\u003cp\u003eGoogle Play uses EMM notifications, sent via Google Cloud Pub/Sub, to inform enterprises of events like app approvals or new device provisioning.\u003c/p\u003e\n"],["\u003cp\u003eEMMs can configure their systems to display alerts to IT administrators based on these notifications.\u003c/p\u003e\n"],["\u003cp\u003ePull notifications are the recommended method for receiving EMM notifications, offering advantages in setup and maintenance.\u003c/p\u003e\n"],["\u003cp\u003e\u003ccode\u003eEnterprises.pullNotificationSet\u003c/code\u003e and \u003ccode\u003eEnterprises.acknowledgeNotificationSet\u003c/code\u003e are used to manage the retrieval and acknowledgment of EMM notifications.\u003c/p\u003e\n"],["\u003cp\u003eVarious notification types correspond to specific events, such as app updates, install failures, and new device provisioning, though some have been deprecated.\u003c/p\u003e\n"]]],[],null,["# Set up EMM notifications\n\nGoogle Play generates notifications, referred to as **EMM notifications** , in\nresponse to various events that affect an enterprise. For example, when an app\nis approved, the system sends a `ProductApprovalEvent` notification.\n\nEMM notifications are associated with a specific [enterprise service account\n(ESA)](/android/work/overview#service_accounts). As an EMM, you can set up your\nconsole to display alerts or messages to enterprise IT administrators based on\nthe notifications that you receive.\n\nEMM notifications are sent using [Google Cloud\nPub/Sub](//cloud.google.com/pubsub/overview). For detailed information on how to\nset up a Pub/Sub notifications, see the [Subscriber\nOverview](//cloud.google.com/pubsub/docs/subscriber) and [Pull Subscriber\nGuide](//cloud.google.com/pubsub/docs/pull).\n\nTo confirm that you have successfully set up your system to receive EMM\nnotifications from Google Play and to retrieve the name of the Cloud Pub/Sub\ntopic that you need to connect your subscription to, call\n[`Enterprises.sendTestPushNotification`](/android/work/play/emm-api/v1/enterprises/sendTestPushNotification).\n\nSending a test notification validates your EMM integration with the Google Cloud\nPub/Sub service for the enterprise. If EMM notifications are properly\nconfigured, the API returns the following: \n\n {\n topic_name: \"/projects/project-name/topics/play-work-012345\",\n message_id: \"128976912439\"\n }\n\nPull notifications\n------------------\n\nGoogle Cloud Pub/Sub supports two different notification mechanisms: pull and\npush. However, only pull notifications are recommended. The pull approach\ndoesn't require any external server setup, and works with both programmatically\nand manually created ESAs. Another advantage of pull notifications is that they\nrequire little to no additional configuration or maintenance by your customers.\nuse\n[`Enterprises.pullNotificationSet`](/android/work/play/emm-api/v1/enterprises/pullNotificationSet)\nand\n[`Enterprises.acknowledgeNotificationSet`](/android/work/play/emm-api/v1/enterprises/acknowledgeNotificationSet)\nto receive and acknowledge EMM notifications over long-running outgoing\nconnections.\n\nWhen calling\n[`Enterprises.pullNotificationSet`](/android/work/play/emm-api/v1/enterprises/pullNotificationSet),\nwe recommend leaving the `requestMode` to its default value\n(`waitForNotifications`). This causes the request to wait until one or more\nnotifications are present before returning a response. If no notifications are\npresent after some time, the request returns an empty notification list, after\nwhich you can try the request again.\n\nAfter you receive notifications, call\n[`Enterprises.acknowledgeNotificationSet`](/android/work/play/emm-api/v1/enterprises/acknowledgeNotificationSet)\nto ensure that the same notifications aren't returned the next time you call\n`Enterprises.pullNotificationSet`.\n\nYou also have the option of setting `requestMode` to `returnImmediately` when\ncalling `Enterprises.pullNotificationSet`. You'll receive a response to the\nrequest immediately, containing any pending notifications or an empty list if no\nnotifications are present. This `requestMode` option may be useful when you\ninitially test your notifications implementation.\n\nExamples of EMM notifications\n-----------------------------\n\nHere are some examples of events and the notification types that they generate:\n\n**Note:** The following notification types have been deprecated:\n`ProductApprovalEvent`, `AppUpdateEvent`, `NewPermissionsEvent`,\n`AppRestrictionsSchemaChangeEvent`, `ProductAvailabilityChangeEvent`, and\n`NewDeviceEvent`. For `AppUpdateEvent`, you must use\n[high-priority update mode](/android/work/play/emm-api/update) as\nper our recommendations.\n\n| Description | Notification |\n|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|------------------------------------|\n| A test notification is requested via the [Google Play EMM API](/android/work/play/emm-api/v1/enterprises/sendTestPushNotification). You need to send a test notification to confirm that your system can receive the notifications that Google Play publishes, and to learn the topic name used for all notifications associated with Google Play. | `TestPushNotification` |\n| A newly provisioned device is ready to be managed by the [Google Play EMM API](/android/work/play/emm-api/v1). You can now call APIs that require the device's `deviceId` ([Installs](/android/work/play/emm-api/v1/installs), for example) and APIs that return a [Devices](/android/work/play/emm-api/v1/devices) resource. This notification is only sent after the first account is provisioned on a managed device. **DEPRECATED** | `NewDeviceEvent` |\n| An administrator marks an application as approved or unapproved in the managed Google Play console. **DEPRECATED** | `ProductApprovalEvent` |\n| A pending installation to a device times out. For example, a push install request is accepted, but the device is not reachable for several days, so the install cannot be confirmed. The system sends an install timeout notification. | `InstallFailureEvent` |\n| A new version of an app is published. The update is available to one or more, but not necessarily all, devices. **DEPRECATED** | `AppUpdateEvent` |\n| An app update requires a new permission to be approved by the admin, so that an update or a new install can occur. This notification is sent when the application's accepted permission set differs from the application's requested permissions set. **DEPRECATED** | `NewPermissionsEvent` |\n| A new version of an app is published that includes a new or modified [managed configurations schema](//developer.android.com/work/managed-configurations.html# define-configuration). When a developer uploads a new APK, Google Play compares the schema in the manifest to the schema in the previous version of the app. If the schema has changed, it notifies enterprises that have approved the app. **DEPRECATED** | `AppRestrictionsSchemaChangeEvent` |\n| An available app becomes unavailable, or an unavailable app is re-added to Google Play. The availability of the app changes if a developer unpublishes it, or it is removed from Google Play. The availability also changes if an unavailable app is re-added to Google Play. **DEPRECATED** | `ProductAvailabilityChangeEvent` |\n| A notification related to an enterprise upgrade. An enterprise upgrade is a process that upgrades a managed Google Play Accounts enterprise to a managed Google Domain. | `EnterpriseUpgradeEvent` |"]]