建立服務帳戶
API Explorer 可讓您直接呼叫 Android Management API。如要從伺服器呼叫 API,您需要為專案啟用 Android Management API 並建立服務帳戶。
啟用 Android Management API
為專案啟用 Android Management API。
登入 Google API 控制台。
選取或建立專案。
前往「Projects」(專案) 頁面
按一下「啟用 API」。
在 API 程式庫中搜尋並選取「Android Management API」。
前往「API Library」(API 程式庫) 頁面
點選「啟用」。
建立服務帳戶
登入 Google API 控制台。
開啟「Credentials」(憑證) 頁面。如果出現提示訊息,請選取已啟用 Android Management API 的專案。
按一下 [Create credentials] (建立憑證) > [Service account key] (服務帳戶金鑰)。
從下拉式選單中選取「新增服務帳戶」。輸入服務帳戶的名稱。
選取您偏好的金鑰類型,然後按一下 [建立]。系統會產生新的公開/私密金鑰組並下載至您的電腦,而且這是這組金鑰的唯一副本。請務必妥善保管。
開啟「身分與存取權管理」頁面。如果出現提示,請選取已啟用 Android Management API 的專案。
按一下 [新增]。
新增您剛剛建立的服務帳戶為成員,然後選取「Android Management User」角色。
點按「儲存」。
(選用,但強烈建議執行) 為現有專案成員授予「擁有者」角色,以新增其他專案擁有者。
角色和權限
如要存取 Android Management API,服務帳戶需要 androidmanagement.enterprises.manage
權限,可由 Android Management 使用者角色 (或 roles/androidmanagement.user
) 授予。
除非另有註明,否則本頁面中的內容是採用創用 CC 姓名標示 4.0 授權,程式碼範例則為阿帕契 2.0 授權。詳情請參閱《Google Developers 網站政策》。Java 是 Oracle 和/或其關聯企業的註冊商標。
上次更新時間:2023-12-02 (世界標準時間)。
[null,null,["上次更新時間: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"]]