- HTTP request
- Path parameters
- Request body
- Response body
- Authorization scopes
- Command
- CommandType
- CommandErrorCode
- ResetPasswordFlag
- ClearAppsDataParams
- StartLostModeParams
- StopLostModeParams
- ClearAppsDataStatus
- PerAppResult
- ClearingResult
- StartLostModeStatus
- Status
- StopLostModeStatus
- Status
- Try it!
Issues a command to a device. The Operation
resource returned contains a Command
in its metadata
field. Use the get operation method to get the status of the command.
HTTP request
POST https://androidmanagement.googleapis.com/v1/{name=enterprises/*/devices/*}:issueCommand
The URL uses gRPC Transcoding syntax.
Path parameters
Parameters | |
---|---|
name |
The name of the device in the form |
Request body
The request body contains an instance of Command
.
Response body
If successful, the response body contains an instance of Operation
.
Authorization scopes
Requires the following OAuth scope:
https://www.googleapis.com/auth/androidmanagement
For more information, see the OAuth 2.0 Overview.
Command
A command.
JSON representation |
---|
{ "type": enum ( |
Fields | |
---|---|
type |
The type of the command. |
create |
The timestamp at which the command was created. The timestamp is automatically generated by the server. A timestamp in RFC3339 UTC "Zulu" format, with nanosecond resolution and up to nine fractional digits. Examples: |
duration |
The duration for which the command is valid. The command will expire if not executed by the device during this time. The default duration if unspecified is ten minutes. There is no maximum duration. A duration in seconds with up to nine fractional digits, ending with ' |
user |
The resource name of the user that owns the device in the form |
error |
If the command failed, an error code explaining the failure. This is not set when the command is cancelled by the caller. |
new |
For commands of type |
reset |
For commands of type |
Union field If this is set, then the fields |
|
clear |
Parameters for the |
start |
Parameters for the |
stop |
Parameters for the |
Union field status . Status specific to the command. Note that some commands do not use this, in particular , , , and . In future these commands may use this as well. status can be only one of the following: |
|
clear |
Output only. Status of the |
start |
Output only. Status of the |
stop |
Output only. Status of the |
CommandType
Types of commands.
Enums | |
---|---|
COMMAND_TYPE_UNSPECIFIED |
This value is disallowed. |
LOCK |
Lock the device, as if the lock screen timeout had expired. |
RESET_PASSWORD |
Reset the user's password. |
REBOOT |
Reboot the device. Only supported on fully managed devices running Android 7.0 (API level 24) or higher. |
RELINQUISH_OWNERSHIP |
Removes the work profile and all policies from a company-owned Android 8.0+ device, relinquishing the device for personal use. Apps and data associated with the personal profile(s) are preserved. The device will be deleted from the server after it acknowledges the command. |
CLEAR_APP_DATA |
Clears the application data of specified apps. This is supported on Android 9 and above. Note that an application can store data outside of its application data, for example in external storage or in a user dictionary. See also . |
START_LOST_MODE |
Puts the device into lost mode. Only supported on fully managed devices or organization-owned devices with a managed profile. See also . |
STOP_LOST_MODE |
Takes the device out of lost mode. Only supported on fully managed devices or organization-owned devices with a managed profile. See also . |
CommandErrorCode
A command error code. This is a read-only field populated by the server.
Enums | |
---|---|
COMMAND_ERROR_CODE_UNSPECIFIED |
There was no error. |
UNKNOWN |
An unknown error occurred. |
API_LEVEL |
The API level of the device does not support this command. |
MANAGEMENT_MODE |
The management mode (profile owner, device owner, etc.) does not support the command. |
INVALID_VALUE |
The command has an invalid parameter value. |
UNSUPPORTED |
The device doesn't support the command. Updating Android Device Policy to the latest version may resolve the issue. |
ResetPasswordFlag
Flags that can be used for the RESET_PASSWORD
command type.
Enums | |
---|---|
RESET_PASSWORD_FLAG_UNSPECIFIED |
This value is ignored. |
REQUIRE_ENTRY |
Don't allow other admins to change the password again until the user has entered it. |
DO_NOT_ASK_CREDENTIALS_ON_BOOT |
Don't ask for user credentials on device boot. |
LOCK_NOW |
Lock the device after password reset. |
ClearAppsDataParams
Parameters associated with the
command to clear the data of specified apps from the device.CLEAR_APP_DATA
JSON representation |
---|
{ "packageNames": [ string ] } |
Fields | |
---|---|
package |
The package names of the apps whose data will be cleared when the command is executed. |
StartLostModeParams
Parameters associated with the
command to put the device into lost mode. At least one of the parameters, not including the organization name, must be provided in order for the device to be put into lost mode.START_LOST_MODE
JSON representation |
---|
{ "lostMessage": { object ( |
Fields | |
---|---|
lost |
The message displayed to the user when the device is in lost mode. |
lost |
The phone number that will be called when the device is in lost mode and the call owner button is tapped. |
lost |
The email address displayed to the user when the device is in lost mode. |
lost |
The street address displayed to the user when the device is in lost mode. |
lost |
The organization name displayed to the user when the device is in lost mode. |
StopLostModeParams
This type has no fields.
Parameters associated with the
command to take the device out of lost mode.STOP_LOST_MODE
ClearAppsDataStatus
Status of the
command to clear the data of specified apps from the device.CLEAR_APP_DATA
JSON representation |
---|
{
"results": {
string: {
object ( |
Fields | |
---|---|
results |
The per-app results, a mapping from package names to the respective clearing result. An object containing a list of |
PerAppResult
The result of an attempt to clear the data of a single app.
JSON representation |
---|
{
"clearingResult": enum ( |
Fields | |
---|---|
clearing |
The result of an attempt to clear the data of a single app. |
ClearingResult
The result of an attempt to clear the data of a single app.
Enums | |
---|---|
CLEARING_RESULT_UNSPECIFIED |
Unspecified result. |
SUCCESS |
This app’s data was successfully cleared. |
APP_NOT_FOUND |
This app’s data could not be cleared because the app was not found. |
APP_PROTECTED |
This app’s data could not be cleared because the app is protected. For example, this may apply to apps critical to the functioning of the device, such as Google Play Store. |
API_LEVEL |
This app’s data could not be cleared because the device API level does not support this command. |
StartLostModeStatus
Status of the
command to put the device into lost mode.START_LOST_MODE
JSON representation |
---|
{
"status": enum ( |
Fields | |
---|---|
status |
The status. See |
Status
The status. See
.StartLostModeStatus
Enums | |
---|---|
STATUS_UNSPECIFIED |
Unspecified. This value is not used. |
SUCCESS |
The device was put into lost mode. |
RESET_PASSWORD_RECENTLY |
The device could not be put into lost mode because the admin reset the device's password recently. |
USER_EXIT_LOST_MODE_RECENTLY |
The device could not be put into lost mode because the user exited lost mode recently. |
ALREADY_IN_LOST_MODE |
The device is already in lost mode. |
StopLostModeStatus
Status of the
command to take the device out of lost mode.STOP_LOST_MODE
JSON representation |
---|
{
"status": enum ( |
Fields | |
---|---|
status |
The status. See |
Status
The status. See
.StopLostModeStatus
Enums | |
---|---|
STATUS_UNSPECIFIED |
Unspecified. This value is not used. |
SUCCESS |
The device was taken out of lost mode. |
NOT_IN_LOST_MODE |
The device is not in lost mode. |