# toggleAirplaneMode

Set the airplane mode state on the device.

> **Note:** Falls back to the deprecated Appium 2 protocol endpoint if the driver does not support the `mobile:` execute method.

note

Unlike the deprecated API which toggled the airplane mode state, this command requires an explicit `enabled` parameter to set the desired state directly.

This command is only supported on Android.

## Usage[​](#usage "Direct link to Usage")

```
await browser.toggleAirplaneMode(enabled)
```

## Parameters[​](#parameters "Direct link to Parameters")

| Name      | Type      | Details                                                       |
| --------- | --------- | ------------------------------------------------------------- |
| `enabled` | `boolean` | Set to `true` to enable airplane mode, `false` to disable it. |

## Example[​](#example "Direct link to Example")

toggleAirplaneMode.js

```
it('should set airplane mode', async () => {
    // Enable airplane mode
    await browser.toggleAirplaneMode(true)
    // Disable airplane mode
    await browser.toggleAirplaneMode(false)
})
```

## Support[​](#support "Direct link to Support")

![Support for android](/assets/images/android-d941e94d5839760141de31c8446b67ce.svg)

**Supported platforms:** Android

note

Refer to the official [Appium driver documentation](https://appium.io/docs/en/latest/ecosystem/) to see which driver versions support this command.
