> ## Documentation Index
> Fetch the complete documentation index at: https://docs.mobileboost.io/llms.txt
> Use this file to discover all available pages before exploring further.

# Launch parameters

> Pass custom data to your app at launch during test execution

Launch parameters allow your app to receive data at launch, enabling you to simulate different user journeys and configurations during automated tests.

For convenience, MobileBoost sets the key `isGptDriver: true` when running your app on the platform, so you can easily detect if your app is running in a test environment.

## Retrieving launch parameters

<Tabs>
  <Tab title="Swift">
    Launch parameters are stored in `UserDefaults` and can be accessed by calling the appropriate method based on type:

    ```swift theme={null}
    UserDefaults.standard.bool(forKey: "isGptDriver")
    UserDefaults.standard.object(forKey: "objectKey")
    UserDefaults.standard.string(forKey: "stringKey")
    ```
  </Tab>

  <Tab title="Kotlin / Java (Intents)">
    Launch parameters are passed as extras in the intent that launches your app:

    ```kotlin theme={null}
    intent.getBooleanExtra("isGptDriver", false)
    intent.getStringExtra("stringKey")
    ```
  </Tab>

  <Tab title="Kotlin / Java (SharedPreferences)">
    Launch parameters are also stored in `SharedPreferences` under a file called `prefs.db`:

    ```kotlin theme={null}
    val preferences = applicationContext.getSharedPreferences("prefs.db", Context.MODE_PRIVATE)

    preferences.getBoolean("isGptDriver", false)
    preferences.getString("stringKey", null)
    ```
  </Tab>
</Tabs>

## Passing launch parameters via API

To pass launch parameters when triggering tests, include a `launchParams` object in your JSON payload to the execute tests endpoint:

```json theme={null}
{
    "organisationId": "<ORG_ID>",
    "uploadId": "<UPLOAD_ID>",
    "launchParams": {
        "<KEY1>": "<VALUE1>",
        "<KEY2>": "<VALUE2>"
    },
    "testIds": [
        "<TEST_ID>"
    ]
}
```

The `launchParams` object accepts any number of key-value pairs based on your requirements.

### Example

Passing a `version` and `featureFlag` parameter:

```json theme={null}
{
    "organisationId": "org12345",
    "uploadId": "upl67890",
    "launchParams": {
        "version": "1.2.0",
        "featureFlag": "true"
    },
    "testIds": [
        "test01",
        "test02"
    ]
}
```

With this setup, the defined launch parameters will be passed to your app when running tests, allowing you to simulate various conditions and configurations during execution.
