生成升级网址后,实现一个按钮(或类似的界面元素),其中嵌入了 IT 管理员将用于启动升级流程的网址。此按钮或类似元素应仅向符合升级条件的企业显示。
建议向 IT 管理员提供指导,说明升级流程并鼓励客户升级。如需了解面向客户的升级信息,请参阅(或直接链接到)这篇帮助中心文章。
Play EMM API Python 示例:
# Enterprise IDENTERPRISE_ID="LC01056q4j"response=msa_service.enterprises().get(enterpriseId=ENTERPRISE_ID).execute()enterprise_type=response['enterpriseType']# Generates an enterprise upgrade URL if the enterprise is a managed Google Play Accounts enterpriseif(enterprise_type!="managedGooglePlayAccountsEnterprise"):response=esa_service.enterprises().generateEnterpriseUpgradeUrl(enterpriseId=ENTERPRISE_ID).execute()print(response['url'])
[null,null,["最后更新时间 (UTC):2025-07-26。"],[],[],null,["# Upgrade an enterprise\n\nAn [Enterprise](/android/work/play/emm-api/v1/enterprises) resource binds an organization to your EMM. Multiple\nenterprise bindings can be associated with a single organization to facilitate\ntest and QA EMM environments, or separate regional EMM implementations.\n\nBindings can be of two different types:\n\n- A managed Google Play Accounts enterprise, which is created by an IT admin using a Gmail account.\n- A managed Google domain enterprise, which is created by an IT admin using their work email (as part of the new recommended [signup flow](/android/work/play/emm-api/create-enterprise#managed_google_domain_sign-up)).\n\nBinding enterprises to a managed Google domain is now the default for Play EMM\nAPI and is strongly encouraged.\n\nThe benefits of using a managed Google domain for an IT admin include:\n\n- Better security and manageability for the IT admin credentials when logging in using a work address versus a Gmail account.\n- Multiple EMM instances can be bound and managed from the same managed Google domain.\n- Multiple Google products and services can be managed with the same IT admin login.\n- Account recovery is simpler for both admin and user accounts on a managed Google domain.\n\nFor users, having enterprises bound to a managed Google domain provides\nseveral advantages, including:\n\n- Simplifies user login by allowing users to login with their work email on Android devices.\n- Allows additional services including SSO, Google Workspace and Gemini on managed devices.\n- Enables cross device experiences including Chrome Sync, sharing files across devices, transferring meetings between devices and more.\n\nThis guide describes how to upgrade a managed Google Play Accounts enterprise\n(created with a Gmail account) to a managed Google domain enterprise.\n\nTypes of upgrades\n-----------------\n\nThere are two mechanisms with which to upgrade a managed Google Play Accounts\nenterprise.\n\n- EMM-initiated: EMMs use APIs to query the binding type, and provide a way for an IT admin to start the upgrade for eligible bindings using a button or a similar UX element directly from their console.\n- Managed Google Play iframe-initiated: organization IT admins can start the upgrade process from the [managed Google Play iframe](/android/work/play/emm-api/managed-play-iframe).\n\nGuidance for EMMs\n-----------------\n\nThe following steps are highly recommended for EMMs, in order to recognize when\nan upgrade happens, support EMM-initiated and iframe-initiated upgrades, and\npresent the updated enterprise information to the IT admin.\n\n### 1. Set up Pub/Sub notifications\n\nIt is highly recommended to sign up for Pub/Sub notifications to receive an\nalert when an enterprise is upgraded. Subscribe to\n[`EnterpriseUpgradeEvent`](/android/work/play/emm-api/v1/enterprises/pullNotificationSet#notification.enterpriseUpgradeEvent) with the enterprise ID of every bound organization\nenterprise to watch for upgrade events. Look for [`upgradeStateSucceeded`](/android/work/play/emm-api/v1/enterprises/pullNotificationSet#notification.enterpriseUpgradeEvent.upgradeState)\nto indicate a successful upgrade.\n\nSince upgrades can happen using both the EMM-initiated flow and [the managed\nGoogle Play iframe](/android/work/play/emm-api/managed-play-iframe), Pub/Sub notifications allow EMMs to monitor both methods\nand take actions that could include:\n\n- Updating contact info in their UI, removing the old Gmail account and updating to the new [administrator\\[\\].email](/android/work/play/emm-api/v1/enterprises#administrator.email) for the upgraded enterprise.\n- Removing messaging that prompts IT admins to upgrade, once the upgrade is complete.\n\nThe same Pub/Sub notification is used for EMM-initiated upgrades as well as\niframe-initiated upgrades.\n\n### 2. Upgrade methods\n\n#### EMM-initiated upgrade flow\n\nEMMs are strongly encouraged to implement the EMM-initiated flow. IT admins that\ninitiate an upgrade using this flow (typically from an EMM console) will be\nredirected to a URL that provides a similar upgrade experience to the\niframe-initiated flow, however the IT admin will **not** be prompted to login to\ntheir existing Gmail account. This shortens and simplifies the upgrade process\nand also provides an upgrade option for customers that don't have access to the\nGmail account originally used to bind the enterprise.\n\n- The first step in the upgrade process is to determine the enterprise type, and whether that enterprise is eligible for upgrade. To determine the enterprise type, call [`enterprises.get`](/android/work/play/emm-api/v1/enterprises/get), and receive `\"enterpriseType\":\n String`. Enterprises of type [`managedGooglePlayAccountsEnterprise`](/android/work/play/emm-api/v1/enterprises#enterpriseType) are eligible for upgrade. Enterprises of type [`managedGoogleDomain`](/android/work/play/emm-api/v1/enterprises#enterpriseType) have either been upgraded, or were created using a work email and thus are not eligible for upgrade.\n- For eligible enterprises generate an enterprise upgrade URL using [`enterprises.generateEnterpriseUpgradeURL`](/android/work/play/emm-api/v1/enterprises/generateEnterpriseUpgradeUrl).\n- After generating the upgrade URL, implement a button (or similar UI element) that embeds the URL which IT admins will use to initiate the upgrade process. This button or similar element should only be shown for enterprises that are eligible for upgrade.\n- It is recommended to provide guidance to the IT admin, explaining the upgrade process and encouraging customers to upgrade. Refer to (or link directly to) this [help center article](https://support.google.com/googleplay/work/answer/7040932) for customer facing information on upgrades.\n\n| **Note:** Take care to only present the upgrade button (or similar UI element) to IT admin roles that are authorized to initiate the upgrade. Since the IT admin is not prompted for the enterprise owner's Gmail credentials, any admin presented with the upgrade URL will be able to execute the upgrade.\n\n**Play EMM API Python example:** \n\n```python\n# Enterprise ID\nENTERPRISE_ID = \"LC01056q4j\"\n\nresponse =\nmsa_service.enterprises().get(enterpriseId=ENTERPRISE_ID).execute()\nenterprise_type = response['enterpriseType']\n\n# Generates an enterprise upgrade URL if the enterprise is a managed Google Play Accounts enterprise\nif (enterprise_type != \"managedGooglePlayAccountsEnterprise\"):\n response = esa_service.enterprises().generateEnterpriseUpgradeUrl(\n enterpriseId=ENTERPRISE_ID\n ).execute()\n print(response['url'])\n```\n\n#### Iframe-initiated upgrade flow\n\nEMMs should be familiar with the flow that IT admins will encounter when\ninitiating an upgrade from the [managed Google Play iframe](/android/work/play/emm-api/managed-play-iframe):\n\n- IT admins will encounter a banner on the top of the iframe for managed Google\n Play enterprises notifying them that they are eligible to upgrade to a managed\n Google domain. The IT admin has the opportunity to initiate the upgrade, or\n close the banner to delay the notification. If closed, the banner will reappear\n after 30 days.\n\n- If an IT admin elects to begin the upgrade they will be prompted to sign in\n with their existing\n [managed Google Play Accounts enterprise owner account](https://support.google.com/googleplay/work/answer/7040932)\n (typically the Gmail address used to originally bind the enterprise). This step\n confirms the admin has rights to initiate the upgrade for this managed Google\n Play enterprise binding.\n\n- Upon successful login, the admin will be prompted to provide their work\n email. If they are already an admin of a managed Google domain with sufficient\n privileges, they will be able to use that account to finish the upgrade steps.\n If there isn't already a domain verified managed Google Domain for that company\n name, the IT admin will be guided to create one.\n\n| **Note:** The managed Google domain created by this step will be an email-verified team. Later the IT admin will want to [verify the domain](https://cloud.google.com/identity/docs/verify-domain) using DNS in order to unlock the full capabilities of the managed Google domain.\n\n- Upon successful login, or completion of the steps to create a managed Google domain admin account, the IT admin will be prompted to confirm their intent to upgrade to a managed Google domain. Completion of this step will result in a success screen and the admin can visit a [help center article](https://support.google.com/work/android/answer/16147675) or log into the Google [admin console](https://admin.google.com).\n\n### 3. After successful upgrade\n\nUpon receiving a Pub/Sub notification of an enterprise upgrade, you can\noptionally call [`enterprises.get`](/android/work/play/emm-api/v1/enterprises/get) to confirm the binding type to be\n`managedGoogleDomain`. The enterprise ID remains the same as it was prior to the\nupgrade.\n\nAfter upgrade, EMMs should remove any messaging shown in their console\nencouraging users to upgrade this enterprise.\n\nThe Gmail address of the IT admin ([`administrator[].email`](/android/work/play/emm-api/v1/enterprises#administrator.email)) will be\nreplaced by a new work email address of the IT admin.\n\nThe [`enterprise`](/android/work/play/emm-api/v1/enterprises) field [`name`](/android/work/play/emm-api/v1/enterprises#name) will also be changed upon upgrade to\nreflect the name of the managed Google domain.\n| **Note:** Any contact info (e.g. Gmail address) for the previously associated binding is deleted upon successful upgrade. If the organization wishes to update contact information, it must be done in the [admin console](https://admin.google.com) of the now associated managed Google domain."]]