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

# Native Push Setup

Detailed, step-by-step setup for push notifications (APNs on iOS, FCM on Android) when integrating [`@suprsend/expo-sdk`](/docs/expo-integration).

<Warning>
  Push notifications do not work in Expo Go. Use a development build (`npx expo run:ios` / `npx expo run:android`) or an EAS development build to test pushes on a real device or simulator.
</Warning>

## iOS — APNs

### 1. Apple Developer portal

Go to [developer.apple.com/account](https://developer.apple.com/account) → **Certificates, IDs & Profiles**.

#### 1a. Enable Push Notifications on the App ID

1. Open **Identifiers**.
2. Select your App ID — the bundle identifier must match `ios.bundleIdentifier` in your `app.json`.
3. Scroll to **Capabilities**, tick **Push Notifications**.
4. Click **Save** (and **Confirm** if prompted).

If the App ID does not exist yet:

1. Click **+** → **App IDs** → **App** → **Continue**.
2. Enter a description and the bundle identifier (must match `app.json`).
3. Tick **Push Notifications** in the Capabilities list.
4. **Continue** → **Register**.

#### 1b. Create an APNs auth key (`.p8`)

This is the credential SuprSend uses to send pushes to APNs. You only need one key per Apple Developer team — it can be reused across apps.

1. Open **Keys** → click **+** (Create a key).
2. Give it a name (for example `suprsend-apns`).
3. Tick **Apple Push Notifications service (APNs)** → **Continue**.
4. **Register** → **Download**.
5. Save the `.p8` file somewhere secure. **Apple only lets you download it once.**
6. Note the **Key ID** shown on the confirmation page.
7. Note your **Team ID** — visible at the top right of the developer account page, under **Membership**.

#### 1c. Configure the SuprSend iOS vendor

In the SuprSend dashboard → **Vendors** → **iOS Push**:

* **Auth key file** — upload the `.p8`.
* **Key ID** — from step 1b.
* **Team ID** — from step 1b.
* **Bundle ID** — must match `ios.bundleIdentifier`.

Save.

### 2. Add the entitlement in your project

In `app.json` add the entitlement:

<CodeGroup>
  ```json app.json theme={"system"}
  {
    "expo": {
      "ios": {
        "bundleIdentifier": "com.yourcompany.yourapp",
        "entitlements": {
          "aps-environment": "development"
        }
      }
    }
  }
  ```
</CodeGroup>

Use `"development"` for Xcode and `expo run:ios` builds; switch to `"production"` for TestFlight and App Store builds.

### 3. Build and run app on simulator / real device

<Note>
  Before building, make sure your app wires up `SuprSendExpoProvider` and `SuprSendPushProvider` as described in the [Push notifications](/docs/expo-push-notifications) guide.
</Note>

<CodeGroup>
  ```bash bash theme={"system"}
  npx expo run:ios
  ```
</CodeGroup>

## Android — FCM

### 1. Create / open a Firebase project

1. Go to [console.firebase.google.com](https://console.firebase.google.com).
2. Either create a new project or open an existing one.
3. Add an **Android app** — the package name must match `android.package` in your `app.json`.
4. Skip the SDK setup steps (Expo's config plugin handles this).
5. Download the generated `google-services.json`.

### 2. Add `google-services.json` to the project

Place the file in your project (the root is the conventional spot) and reference it from `app.json` via `android.googleServicesFile`:

<CodeGroup>
  ```text Project structure theme={"system"}
  your-app/
  ├── app.json
  ├── google-services.json   ← conventional location
  ├── package.json
  └── ...
  ```
</CodeGroup>

Reference it in `app.json`:

<CodeGroup>
  ```json app.json theme={"system"}
  {
    "expo": {
      "android": {
        "package": "com.yourcompany.yourapp",
        "googleServicesFile": "./google-services.json"
      }
    }
  }
  ```
</CodeGroup>

<Warning>
  Do not commit `google-services.json` if your repo is public — it embeds your Firebase project ID and API key. Add it to `.gitignore` and distribute via your secrets pipeline.
</Warning>

### 3. Get the FCM V1 service account credential

SuprSend uses FCM HTTP v1, which requires a service-account JSON (not the legacy server key).

1. In Firebase console → **Project settings** (gear icon) → **Service accounts** tab.
2. Select **Firebase Admin SDK**, language doesn't matter.
3. Click **Generate new private key** → **Generate key**.
4. Save the downloaded JSON file securely.

### 4. Configure the SuprSend Android vendor

In the SuprSend dashboard → **Vendors** → **Android Push (FCM)**:

* Upload the service-account JSON from step 3.
* Save.

### 5. Build and run app on emulator / real device

<Note>
  Before building, make sure your app wires up `SuprSendExpoProvider` and `SuprSendPushProvider` as described in the [Push notifications](/docs/expo-push-notifications) guide.
</Note>

<CodeGroup>
  ```bash bash theme={"system"}
  npx expo run:android
  ```
</CodeGroup>
