创建服务账号
借助 API Explorer,您可以直接调用 Android Management API。如需从服务器调用 API,您需要为项目启用 Android Management API 并创建一个服务帐号。
启用 Android Management API
为您的项目启用 Android Management API。
登录 Google API 控制台。
选择或创建一个项目。
转到“项目”页面
点击启用 API。
在 API 库中搜索并选择 Android Management API。
转到“API 库”页面
点击启用。
创建您的服务帐号
登录 Google API 控制台。
打开“凭据”页面。
如果出现提示,请选择已启用 Android Management API 的项目。
点击创建凭据 > 服务账号密钥。
从下拉菜单中选择新的服务帐号。输入服务帐号的名称。
选择您的首选密钥类型,然后点击创建。您的新公钥/私钥对已生成并下载到您的计算机,它是此密钥的唯一副本。您负责安全存储该密钥。
打开 IAM 页面。如果出现提示,请选择已启用 Android Management API 的项目。
点击添加。
将您刚刚创建的服务帐号添加为成员,然后选择 Android Management User 角色。
点击保存。
(可选,但强烈建议)通过向现有项目成员授予 Owner 角色来添加其他项目所有者。
角色与权限
要访问 Android Management API,您的服务帐号需要 androidmanagement.enterprises.manage
权限,该权限可由 Android Management User 角色(或 roles/androidmanagement.user
)授予。
如未另行说明,那么本页面中的内容已根据知识共享署名 4.0 许可获得了许可,并且代码示例已根据 Apache 2.0 许可获得了许可。有关详情,请参阅 Google 开发者网站政策。Java 是 Oracle 和/或其关联公司的注册商标。
最后更新时间 (UTC):2023-12-02。
[null,null,["最后更新时间 (UTC):2023-12-02。"],[[["Use the APIs Explorer to directly interact with the Android Management API."],["To call the API from a server, enable the Android Management API for your Google Cloud project and create a service account with the \"Android Management User\" role."],["Securely store the generated public/private key pair for your service account as it is the only copy and crucial for API access."],["Optionally, enhance project security by granting the \"Owner\" role to existing project members for additional oversight."]]],["To use the Android Management API, first enable it in the Google API Console by selecting your project and enabling it. Then, create a service account by generating a new key pair. Next, assign the \"Android Management User\" role to the service account in the IAM page. The service account needs the `androidmanagement.enterprises.manage` permission, granted by the role. Optionally, add project owners with the Owner role.\n"]]