Lost mode is a feature available on company-owned devices, allowing employers to
remotely lock and secure a lost device and optionally to display a message on
the device screen with contact information for the employee or IT department.
This helps protect organization and employee data while attempting to recover
the device, and may improve the likelihood of recovery.

**Note:** Lost mode is helpful when there is the chance the device may be
recovered, because when recovered the device can be used for work immediately,
with no loss of data and no need to re-provision the device. While we recommend
that you first use lost mode to try to recover the device, if after activating
lost mode for at least 24 hours you still haven't recovered the device, we
recommend remotely wiping the device to provide the strongest protections for
work data.

## Prerequisites

A device must be company-owned; work profile is
supported on Android 13 and above, and fully managed devices on Android 11 and
above.

## Start Lost Mode

To put a device into lost mode, issue a command to a device with the command
type
[`START_LOST_MODE`](https://developers.google.com/android/management/reference/rest/v1/enterprises.devices/issueCommand#CommandType.ENUM_VALUES.START_LOST_MODE).
At least one of the following details must be provided with the command:

- Lost message
- Phone number
- Email address
- Street address

Optionally, the IT admin can choose to provide the following:

- Organization name

Example:

```
command_body = '''{
 "type": "START_LOST_MODE",
 "startLostModeParams": {
   "lostOrganization": {
     "defaultMessage": "Example Organisation",
     "localizedMessages":{
       "en-US": "Example Organisation"
     }
   },
   "lostStreetAddress": {
     "defaultMessage": "1800 Amphibious Blvd. Mountain View, CA 94045",
     "localizedMessages":{
       "en-US": "1800 Amphibious Blvd. Mountain View, CA 94045"
     }
   }
 }
}'''

androidmanagement.enterprises().devices().issueCommand(
   name='enterprises/{}/devices/{}'.format(enterprise_id, device_id),
   body=json.loads(command_body)
).execute()
```

Once successfully placed into lost mode, the device is locked, all apps are
blocked, and the device's `DeviceState` is changed to
[`LOST`](https://developers.google.com/android/management/reference/rest/v1/enterprises.devices#DeviceState.ENUM_VALUES.LOST).

A device cannot be placed into lost mode if:

- The device is not an [organization-owned device](https://developers.google.com/android/management/reference/rest/v1/enterprises.devices#managementmode)
- The device is already in lost mode
- The device password has been reset by an IT admin in the last 12 hours
- The employee manually exited lost mode in the last 12 hours
- It is a [work profile on a company-owned device](https://developers.google.com/android/management/policies/work-profile#company-owned_devices) **and** the work profile is paused

**Note:** Lost mode is supported in direct boot mode.

### Alert State

This is the first state a device enters when put into lost mode. In this state,
the device rings for up to 5 minutes, giving the user an opportunity to find
their device and take the device out of lost mode. The location of the device is
not reported during this time.
![lost-mode-state-one](https://developers.google.com/static/android/management/images/lostmodestate.png) **Figure 1.** The device showing in lost mode, in the lost and alert state.

If the device is accessed in the alert state, two options are presented:

- **This is my device** - allows the employee to enter their password and take the device out of lost mode. If this occurs before the 5 minute period ends, no location data is sent from the device to the admin.
- **I found this device** - enables someone other than the employee to stop the device ringing. This moves the device into the lost state.

**Note:** The device location is only shared with the admin after the 5 minutes
has elapsed.

### Lost State

In this state the device stops ringing and sends periodic location updates.
Location updates are sent as [usage
logs](https://developers.google.com/android/management/reference/rest/v1/BatchUsageLogEvents#lostmodelocationevent),
to which an EMM can subscribe using [pub/sub
notifications](https://developers.google.com/android/management/notifications#3_create_a_subscription).

The location reporting frequency is subject to standard Android
[Doze mode](https://developer.android.com/training/monitoring-device-state/doze-standby).
When the device is unplugged, stationary, and its screen is off, it enters Doze
mode, which defers background network access and periodic location updates to
conserve battery. The device automatically exits Doze mode and resumes regular
location updates as soon as physical movement is detected, the screen is
activated, or the device is connected to a charger.
![lost-mode-reported-lost](https://developers.google.com/static/android/management/images/lostmodeexample.png) **Figure 1.** The device showing in lost mode, reported as lost.

If the device is accessed in the lost state, up to three options are shown:

- **Unlock** - allows the employee to enter their passcode and take the device out of lost mode.
- **Call owner** - starts a phone call to the number provided in the start lost mode parameters. This option is hidden if no phone number is provided.
- **Emergency** - allows access to the emergency dialer.

## Stop Lost Mode

To take a device out of lost mode, issue a command to a device with the command
type
[`STOP_LOST_MODE`](https://developers.google.com/android/management/reference/rest/v1/enterprises.devices/issueCommand#CommandType.ENUM_VALUES.STOP_LOST_MODE).
Unlike the start lost mode command, no additional information needs to be
provided. The device can also be taken out of lost mode manually by providing
the device password.

Example:

```
command_body = '''{
  "type": "STOP_LOST_MODE",
  "stopLostModeParams": {}
}'''

androidmanagement.enterprises().devices().issueCommand(
  name='enterprises/{}/devices/{}'.format(enterprise_id, device_id),
  body=json.loads(command_body)
).execute()
```

<br />

When the device is successfully taken out of lost mode, all apps on the device
are unblocked and the employee can use the device as normal. The device's
applied state resets to the state the device was in before lost mode.

## Pub/sub notifications

To receive lost mode messages, like confirmation of a device entering or exiting
lost mode, you must enable and subscribe an enterprise to the `COMMAND` and
`USAGE_LOGS` [notification types](https://developers.google.com/android/management/notifications).

The `COMMAND` pub/sub provides information on the following events:

- [`StartLostModeStatus`](https://developers.google.com/android/management/reference/rest/v1/enterprises.devices/issueCommand#startlostmodestatus) - indicates that the admin has successfully put the device into lost mode.
- [`StopLostModeStatus`](https://developers.google.com/android/management/reference/rest/v1/enterprises.devices/issueCommand#stoplostmodestatus) - indicates that the admin has successfully taken the device out of lost mode.

The `USAGE_LOGS` pub/sub provides information on the following events:

- [`LostModeLocationEvent`](https://developers.google.com/android/management/reference/rest/v1/BatchUsageLogEvents#lostmodelocationevent) - there is a location and battery update.
- [`StopLostModeUserAttemptEvent`](https://developers.google.com/android/management/reference/rest/v1/BatchUsageLogEvents#stoplostmodeuserattemptevent) - if someone tries to take a device out of lost mode, either successfully or unsuccessfully.
- [`LostModeOutgoingPhoneCallEvent`](https://developers.google.com/android/management/reference/rest/v1/BatchUsageLogEvents#lostmodeoutgoingphonecallevent) - if someone makes an outgoing phone call.

**Note:** Actions executed by the admin trigger notifications in the `COMMAND`
pub/sub. Actions executed by the employee trigger notifications in the
`USAGE_LOGS` pub/sub.