> For the complete documentation index, see [llms.txt](https://doc.batch.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://doc.batch.com/developer/sdk/react-native/sdk-integration/expo-integration.md).

# Expo Integration

*Expo 54+ and Batch-React-Native v12 are required.*

The Batch React-Native Plugin can be integrated with Expo in bare and managed workflow, but it cannot be used thought the Expo Go app because this last doesn't support custom native code.

### Installation

Start installing the `Batch-React-Native-Plugin` with the package manager of your choice:

{% tabs %}
{% tab title="Yarn" %}

```sh
yarn add @batch.com/react-native-plugin //v12+ required
```

{% endtab %}

{% tab title="NPM" %}

<pre class="language-python"><code class="lang-python"><strong>npm install @batch.com/react-native-plugin
</strong></code></pre>

{% endtab %}
{% endtabs %}

Then install the the `Batch-Expo-Plugin`:

```
npx expo install @batch.com/expo-plugin
```

### Configure

Then add the plugin to your app configuration file :

{% code title="app.json or app.config.js" %}

```json
{
  "expo": {
    ...,
    "plugins": [
      [
        "@batch.com/expo-plugin",
        {
          "androidApiKey": "YOUR_ANDROID_BATCH_API_KEY",
          "iosApiKey": "YOUR_IOS_BATCH_API_KEY",
        }
      ]
    ]
  }
}
```

{% endcode %}

#### Configuration options

<table><thead><tr><th width="272.5859375">Key</th><th width="254.71875">Description</th><th width="80.04296875">Type</th><th width="78.3125">Default</th><th data-type="checkbox">Required</th></tr></thead><tbody><tr><td><code>iosApiKey</code></td><td>Your Batch iOS Api key</td><td>string</td><td>/</td><td>true</td></tr><tr><td><code>androidApiKey</code></td><td>Your Batch Android Api key</td><td>string</td><td>/</td><td>true</td></tr><tr><td><code>enableDoNotDisturb</code></td><td>Whether Batch should start in "do not disturb" (DnD) mode, or not.</td><td>boolean</td><td>false</td><td>false</td></tr><tr><td><code>enableDefaultOptOut</code></td><td>Whether Batch should be opted-out by default</td><td>boolean</td><td>false</td><td>false</td></tr><tr><td><code>enableProfileCustomIDMigration</code></td><td>Whether Batch should automatically identify logged-in user when running the SDK v2 for the first time.</td><td>boolean</td><td>true</td><td>false</td></tr><tr><td><code>enableProfileCustomDataMigration</code></td><td>Whether Batch should automatically attach current installation's data to the User's Profile when running the SDK v2 for the first time</td><td>boolean</td><td>true</td><td>false</td></tr><tr><td><code>androidSmallIconResourceId</code></td><td>The android small notification icon resource id. eg: "@drawable/push_icon"</td><td>string</td><td>/</td><td>false</td></tr><tr><td><code>androidNotificationsColor</code></td><td>The push notification accent color (You should pass an aRGB integer, eg: #ffff2189).</td><td>string</td><td>/</td><td>false</td></tr><tr><td><code>enableIOSRichNotifications</code></td><td>Wether Batch should enable the rich push notifications on iOS</td><td>boolean</td><td>false</td><td>false</td></tr></tbody></table>

### Enable push notifications

Add the following in your app code, ideally the first view a user sees when opening the app:

```js
import { BatchPush } from '@batch.com/react-native-plugin'

// Ask for the permission to display notifications
BatchPush.requestNotificationAuthorization()
// Or use the async variant
// const granted = await BatchPush.requestNotificationAuthorizationAsync()

// iOS ONLY:
// Using the above method, the push token will automatically be fetched by the SDK.

// Alternatively, you can call requestNotificationAuthorization later
// But, you should always refresh your token on each application start
// This will make sure that even if your user's token changes, you still get notifications
// BatchPush.refreshToken();
```

### Build and run locally

Once the plugin is installed you will need to run the `expo prebuild --clean` command to rebuild the app with the plugin changes.

Then you can run your application with `expo run:android` or `expo run:ios`.

### Build with EAS

When you are ready to go to production or to provide a new development client (for internal testing) containing your newly added custom native code: [build your app with custom native code with EAS](https://docs.expo.dev/workflow/customizing/#releasing-apps-with-custom-native-code-to)

You will have to register every iOS device you plan on testing on with `eas device:create` (it has to be done before the build)


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://doc.batch.com/developer/sdk/react-native/sdk-integration/expo-integration.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
