Devices: setState

  • This method allows setting a device's access to Google services as enabled or disabled.

  • The device state change is only effective if enforcing EMM policies is enabled in the Google Admin Console.

  • This functionality is supported only for Google-managed users.

  • The request requires authorization and involves specifying the device, enterprise, and user IDs in the path parameters.

  • The request body specifies the desired account state, which can be either "enabled" or "disabled".

Note:Requiresauthorization.

Sets whether a device's access to Google services is enabled or disabled.The device state takes effect only if enforcing EMM policies on Androiddevices is enabled in the Google Admin Console.Otherwise, the device state is ignored and all devices are allowed accessto Google services.This is only supported for Google-managed users.

Request

HTTP request

PUT https://www.googleapis.com/androidenterprise/v1/enterprises/enterpriseId/users/userId/devices/deviceId/state

Parameters

Parameter nameValueDescription
Path parameters
deviceIdstring The ID of the device.
enterpriseIdstring The ID of the enterprise.
userIdstring The ID of the user.

Authorization

This request requires authorization with the following scope:

Scope
https://www.googleapis.com/auth/androidenterprise

For more information, see theauthentication and authorization page.

Request body

In the request body, supply data with the following structure:

{  "kind": "androidenterprise#deviceState",  "accountState":string}
Property nameValueDescriptionNotes
accountStatestringThe 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.

Acceptable values are:
  • "disabled"
  • "enabled"
kindstring

Response

If successful, this method returns a response body with the following structure:

{  "kind": "androidenterprise#deviceState",  "accountState":string}
Property nameValueDescriptionNotes
accountStatestringThe 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.

Acceptable values are:
  • "disabled"
  • "enabled"
kindstring

Except as otherwise noted, the content of this page is licensed under theCreative Commons Attribution 4.0 License, and code samples are licensed under theApache 2.0 License. For details, see theGoogle Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.

Last updated 2024-10-31 UTC.