环境准备和用户注册
使用集合让一切井井有条
根据您的偏好保存内容并对其进行分类。
Android Management API (AMAPI) SDK 在新的自定义设备政策控制器 (DPC) 注册流程中发挥着重要作用。它有助于 EMM 自定义 DPC 应用与 Android 设备政策 (ADP) 之间的通信,并通过与 Play EMM API 互动来简化设备注册流程,以实现密钥注册功能。
AMAPI SDK 的主要功能:
- 启用 EMM DPC 应用与 Android Device Policy 之间的通信。
- 有助于在本地执行命令。
- 支持用于添加受管理的 Google 账号的新设备注册流程。
- 在需要时管理 Android Device Policy 的安装或更新。
在自定义 DPC 注册流程中,该 SDK 至关重要,原因主要有以下两点:
它通过帮助在设备上正确安装和更新 Android Device Policy 来设置环境。
它用于在本地调用 Android 设备政策,从而在设备上启动用户登录序列。
这些基础功能可为设备管理做好准备,并使后续注册步骤成为可能。
环境
AMAPI SDK 的 EnvironmentClient
是一种接口,可用于访问与环境相关的 API。您可以使用 EnvironmentClientFactory
创建实例。
EnvironmentClient
的主要功能:
- 确保 SDK API 级别满足最低要求。
- 检查并根据需要启动 Google Play 服务的更新。
- 验证 Android 设备政策是否已安装并更新。请注意,此过程可能需要一些时间,因为它可能涉及安装或更新。
如需详细了解 EnvironmentClient
接口,请参阅参考文档。
AccountSetup
AMAPI SDK 中的 AccountSetup
类负责管理在受管 Android 设备上设置 Google 账号的过程。
AccountSetup 的主要功能:
- 使用
AccountSetupClient
和注册令牌启动账号设置流程。
- 处理由 EMM 生成并传递给 AMAPI SDK 的注册令牌。此令牌用于确定是否需要进行用户身份验证。
- 根据需要启动身份验证 activity,提示用户使用其 Google 凭据登录。
- 成功登录后,接收包含用户电子邮件地址和用户 ID 的回调。
- EMM 使用收到的用户标识符通过
Devices.update
方法设置设备政策。
- EMM 会调用
Devices.setState
将设备标记为合规,并允许访问 Google 服务。
此功能是一种新的设备注册方法,可利用 AMAPI SDK 而不是 DPC 支持库。如需详细了解 AccountSetup
,请参阅 AMAPI 参考文档和实现用户账号指南。
如未另行说明,那么本页面中的内容已根据知识共享署名 4.0 许可获得了许可,并且代码示例已根据 Apache 2.0 许可获得了许可。有关详情,请参阅 Google 开发者网站政策。Java 是 Oracle 和/或其关联公司的注册商标。
最后更新时间 (UTC):2025-08-25。
[null,null,["最后更新时间 (UTC):2025-08-25。"],[],[],null,["# Environment preparation and user enrollment\n\nThe Android Management API (AMAPI) SDK plays a important role in the new custom\nDevice Policy Controller (DPC) enrollment flow. It facilitates communication\nbetween EMM custom DPC apps and Android Device Policy (ADP) and streamlines\ndevice enrollment by interacting with the Play EMM API for key enrollment\nfunctions.\n\nKey functions of the AMAPI SDK:\n-------------------------------\n\n- Enables communication between EMM DPC apps and Android Device Policy.\n- Facilitates local execution of commands.\n- Supports the new device enrollment flow for adding managed Google Accounts.\n- Manages the installation or updates of Android Device Policy when needed.\n\nThe SDK is essential for two primary reasons in the custom DPC enrollment flow:\n\n1. It sets the environment by helping to install and update Android Device\n Policy correctly on the device.\n\n2. It is used to call Android Device Policy locally, which initiates the user\n login sequence on the device.\n\nThese foundational functions prepare the device for management and make the\nsubsequent enrollment steps possible.\n\n*** ** * ** ***\n\nEnvironment\n-----------\n\nThe AMAPI SDK's `EnvironmentClient` is an interface that allows access to\nenvironment-related APIs. You can create an instance using\n`EnvironmentClientFactory`.\n\n### Key features of the `EnvironmentClient`:\n\n- Makes sure the SDK API level meets the minimum requirement.\n- Checks for and initiates an update for Google Play services if needed.\n- Verifies that Android Device Policy is installed and updated. Be aware that this process can take some time as it may involve an installation or update.\n\nFor more details on the `EnvironmentClient` interface, see the [reference\ndocumentation](/android/management/reference/amapi/com/google/android/managementapi/environment/EnvironmentClient).\n\n*** ** * ** ***\n\nAccountSetup\n------------\n\nThe `AccountSetup` class within the AMAPI SDK is responsible for managing the\nprocess of setting up a Google Account on a managed Android device.\n\n### Key features of the AccountSetup:\n\n- Starts the account setup process using the `AccountSetupClient` and an enrollment token.\n- Handles the enrollment token, which is generated by the EMM and passed to the AMAPI SDK. This token determines whether user authentication is required.\n- Launches an authentication activity if needed, prompting the user to sign in with their Google credentials.\n- Receives a callback with the user's email and user ID upon successful sign-in.\n- The EMM uses the received user identifiers to set the device policy with the [`Devices.update`](/android/work/play/emm-api/v1/devices/update) method.\n- The EMM calls [`Devices.setState`](/android/work/play/emm-api/v1/devices/setState) to mark the device as compliant and allow access to Google services.\n\nThis functionality is part of a new device enrollment method that leverages the\nAMAPI SDK instead of the DPC support library. For more details on `AccountSetup`\nsee [AMAPI reference\ndocumentation](/android/management/reference/amapi/com/google/android/managementapi/accountsetup/package-summary)\nand [Implement the user accounts\nguide](/android/work/play/emm-api/implement-user-accounts)."]]