重要資訊:我們目前不接受新的 Play EMM API 註冊。
瞭解詳情。
Devices: getState
透過集合功能整理內容
你可以依據偏好儲存及分類內容。
擷取裝置是否已啟用 Google 服務的存取權,或
已停用。
只有在 Google 管理控制台中啟用在 Android 裝置上強制執行 EMM 政策的情況下,裝置狀態才會生效。否則,系統會忽略裝置狀態並允許存取所有裝置
。
這項功能僅適用於由 Google 管理的使用者。
要求
HTTP 要求
GET https://www.googleapis.com/androidenterprise/v1/enterprises/enterpriseId/users/userId/devices/deviceId/state
參數
參數名稱 |
值 |
說明 |
路徑參數 |
deviceId |
string |
裝置的 ID。
|
enterpriseId |
string |
企業的 ID。
|
userId |
string |
使用者的 ID。
|
授權
此要求需要具有下列範圍的授權:
範圍 |
https://www.googleapis.com/auth/androidenterprise |
詳情請參閱「驗證與授權」網頁。
要求主體
請勿透過此方法提供要求主體。
回應
如果成功的話,這個方法會傳回回應內文,其結構如下:
{
"kind": "androidenterprise#deviceState",
"accountState": string
}
屬性名稱 |
值 |
說明 |
附註 |
accountState |
string |
裝置上的 Google 帳戶狀態。「已啟用」表示裝置上的 Google 帳戶可用於存取 Google 服務 (包括 Google Play),而「已停用」則表示無法存取。新裝置處於「已停用」狀態時間。
可接受的值為:
|
|
kind |
string |
|
|
除非另有註明,否則本頁面中的內容是採用創用 CC 姓名標示 4.0 授權,程式碼範例則為阿帕契 2.0 授權。詳情請參閱《Google Developers 網站政策》。Java 是 Oracle 和/或其關聯企業的註冊商標。
上次更新時間:2024-09-13 (世界標準時間)。
[null,null,["上次更新時間:2024-09-13 (世界標準時間)。"],[[["\u003cp\u003eRetrieves a device's access status to Google services (enabled or disabled) for Google-managed users.\u003c/p\u003e\n"],["\u003cp\u003eDevice state is enforced only if EMM policies are enabled in the Google Admin Console, otherwise all devices are allowed access.\u003c/p\u003e\n"],["\u003cp\u003eRequires authorization with the \u003ccode\u003ehttps://www.googleapis.com/auth/androidenterprise\u003c/code\u003e scope.\u003c/p\u003e\n"],["\u003cp\u003eResponse indicates the Google account state on the device as either "enabled" or "disabled".\u003c/p\u003e\n"]]],[],null,["# Devices: getState\n\n| **Note:** Requires [authorization](#auth).\n\nRetrieves whether a device's access to Google services is enabled or\ndisabled.\nThe device state takes effect only if enforcing EMM policies on Android\ndevices is enabled in the Google Admin Console.\nOtherwise, the device state is ignored and all devices are allowed access\nto Google services.\nThis is only supported for Google-managed users.\n\nRequest\n-------\n\n### HTTP request\n\n```\nGET https://www.googleapis.com/androidenterprise/v1/enterprises/enterpriseId/users/userId/devices/deviceId/state\n```\n\n### Parameters\n\n| Parameter name | Value | Description |\n|----------------|----------|---------------------------|\n| **Path parameters** |||\n| `deviceId` | `string` | The ID of the device. |\n| `enterpriseId` | `string` | The ID of the enterprise. |\n| `userId` | `string` | The ID of the user. |\n\n### Authorization\n\nThis request requires authorization with the following scope:\n\n| Scope |\n|-----------------------------------------------------|\n| `https://www.googleapis.com/auth/androidenterprise` |\n\nFor more information, see the [authentication and authorization](/android/work/play/emm-api/v1/how-tos/authorizing) page.\n\n### Request body\n\nDo not supply a request body with this method.\n\nResponse\n--------\n\nIf successful, this method returns a response body with the following structure:\n\n```text\n{\n \"kind\": \"androidenterprise#deviceState\",\n \"accountState\": string\n}\n```\n\n| Property name | Value | Description | Notes |\n|----------------|----------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|-------|\n| `accountState` | `string` | The state of the Google account on the device. \"enabled\" indicates that the Google account on the device can be used to access Google services (including Google Play), while \"disabled\" means that it cannot. A new device is initially in the \"disabled\" state. \u003cbr /\u003e Acceptable values are: - \"`disabled`\" - \"`enabled`\" | |\n| `kind` | `string` | | |"]]