# launchApp

Launch or activate an app on the device. If no `bundleId` (iOS) or `appId` (Android) is provided, the command will automatically detect and activate the currently active app.

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

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

```
await browser.launchApp({ bundleId, arguments, environment, appId })
```

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

| Name                                  | Type               | Details                                                                                                                   |
| ------------------------------------- | ------------------ | ------------------------------------------------------------------------------------------------------------------------- |
| `options`<br />*optional*             | `object`           | Options for launching the app (optional)                                                                                  |
| `options.bundleId`<br />*optional*    | `string`           | The bundle ID of the iOS app to launch. If not provided, the currently active app is used.<br />**iOS-ONLY**              |
| `options.arguments`<br />*optional*   | `string, string[]` | Command line arguments to pass to the app on launch.<br />**iOS-ONLY**                                                    |
| `options.environment`<br />*optional* | `object`           | Environment variables to set when launching the app (key-value pairs).<br />**iOS-ONLY**                                  |
| `options.appId`<br />*optional*       | `string`           | The package name of the Android app to activate. If not provided, the currently active app is used.<br />**ANDROID-ONLY** |

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

launchApp.js

```
it('should launch a specific iOS app', async () => {
    // iOS: launch a specific app by bundle ID
    await browser.launchApp({ bundleId: 'com.example.myapp' })
})
it('should launch an iOS app with arguments and environment', async () => {
    // iOS: launch an app and pass arguments and environment variables
    await browser.launchApp({
        bundleId: 'com.example.myapp',
        arguments: ['-AppleLanguages', '(en)'],
        environment: { MY_ENV_VAR: 'value' }
    })
})
it('should launch a specific Android app', async () => {
    // Android: activate/launch a specific app by package name
    await browser.launchApp({ appId: 'com.example.myapp' })
})
it('should activate the currently active app', async () => {
    // Automatically detect and activate the current app
    await browser.launchApp()
})
```

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

![Support for ios](data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iaXNvLTg4NTktMSI/Pgo8IS0tIEdlbmVyYXRvcjogQWRvYmUgSWxsdXN0cmF0b3IgMTYuMC4wLCBTVkcgRXhwb3J0I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ny0xMzQuNzYyLDE2MS4zNTcKCWMtMzUuNTY1LDAtNjMuMjE1LTIzLjk2Ny0xMDAuNjg4LTIzLjk2N2MtMzguMTg4LDAtNzYuMDg0LDI0Ljg2MS0xMDAuNzY2LDI0Ljg2MUM4OS4zMyw2MDguNzMsMCw0NTUuNjY2LDAsMzMyLjYyOAoJYzAtMTIxLjA1Miw3NS42MTItMTg0LjU1NCwxNDYuNTMzLTE4NC41NTRDMTkyLjYzOCwxNDguMDc0LDIyOC40MTYsMTc0LjY2MiwyNTIuMzg1LDE3NC42NjJ6Ii8+Cjwvc3ZnPgo=) ![Support for android](/assets/images/android-d941e94d5839760141de31c8446b67ce.svg)

**Supported platforms:** iOS, Android

note

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