> This page is part of the [Customer.io documentation](https://docs.customer.io). For the complete index, see [llms.txt](https://docs.customer.io/llms.txt).
> Last updated: October 27, 2026
> To take actions in Customer.io from an agent, use the [Customer.io CLI](https://docs.customer.io/ai/cli/get-started.md) or the [MCP server](https://docs.customer.io/ai/mcp/get-started.md).
> This page has tabbed examples for: Foreground Listener, Background Listener, FCM token, Firebase Installation ID. Add `?tab=<name>` to the URL to get only that tab, and repeat it for more than one, for example `?tab=foreground-listener&tab=background-listener`.

# Handling multiple push providers

## How to handle multiple push providers

If Customer.io is the only SDK that you use in your app to display push notifications, then you don’t need to do anything special to display push notifications.

But, if you use another module in your app that can display push notifications like `expo-notifications`, `react-native-push-notification`, or `rnfirebase`, these modules can take over push handling by default and prevent your app from receiving push notifications from Customer.io.

You can solve this problem using one (and **only one**) of the methods below, but we typically recommend [the first option](#cio-process-notification-payloads), because it doesn’t require you to write native code! Please note that the following methods will always return `true` for iOS.

## Option 1 (Recommended): Set Customer.io SDK to handle push clicks

You can pass the payloads of other message services to Customer.io whenever a device receives a notification, and our SDK can process it for you. The SDK exposes the `onMessageReceived` method for this that takes two arguments:

*   a `message.data` object containing the incoming notification payload
*   a `handleNotificationTrigger` boolean indicating whether or not to trigger a notification.
    *   `true` (default) means that the Customer.io SDK will generate the notification and track associated metrics.
    *   `false` means that the SDK will process the notification to track metrics but *will not* generate a notification on the device.

You’ll use the `onMessageReceived` like this:

```
CustomerIO.pushMessaging.onMessageReceived(message).then(handled => {
  // If true, the push was a Customer.io notification and handled by our SDK
  // Otherwise, `handled` is false
});
```

You can pass values in `onMessageReceived` by listening to notification events exposed by other SDKs. Make sure that you add listeners in the right places to process notifications that your app receives when it’s in the foreground and add background listeners that might be required by other SDK to process notifications that your app receives when it’s in background/killed state.

If you *always* send rich push messages (with `image` and/or `link`), adding event listeners is enough. But if you send custom push payloads using the `notification` object or send simple push messages (with just a `body` and `title`), you may get duplicate notifications when your app is in the background because Firebase itself displays notifications sent using the `notification` object.

To avoid this, You can pass `false` in `handleNotificationTrigger` to track metrics for simple and custom payload push notifications. To simplify this behavior, the SDK also exposes an `onBackgroundMessageReceived` method that automatically suppresses pushes with the notification object when your app is in background.

If you use `rnfirebase`, you can setup listeners like this:

<!-- tabs -->

<!-- tab: Foreground Listener -->

#### Foreground Listener

To listen to messages in the foreground, set `onMessage` listener where appropriate:

```
useEffect(() => {
  const unsubscribe = messaging().onMessage(async remoteMessage => {
    CustomerIO.pushMessaging.onMessageReceived(remoteMessage).then(handled => {
        // If true, the push was a Customer.io notification and handled by our SDK
        // Otherwise, `handled` is false
    });
  });

  return unsubscribe;
}, []);
```

<!-- /tab -->

<!-- tab: Background Listener -->

#### Background Listener

To listen to messages when app is in background/killed state, set `setBackgroundMessageHandler` in your `index.js` file

```
messaging().setBackgroundMessageHandler(async remoteMessage => {
  CustomerIO.pushMessaging.onBackgroundMessageReceived(remoteMessage).then(handled => {
    // If true, the push was a Customer.io notification and handled by our SDK
    // Otherwise, `handled` is false
  });
});
```

<!-- /tab -->

<!-- /tabs -->

### Forward token refreshes on Android

On Android, React Native Firebase’s messaging service has a higher priority than Customer.io’s, so Firebase sends new tokens to React Native Firebase. The Customer.io SDK fetches the current token each time your app starts. When Firebase refreshes the token while your app is running, Customer.io gets the new token the next time your app starts.

To register the new token right away, forward React Native Firebase’s registration events to `CustomerIO.registerDeviceToken`. The examples below forward tokens only on Android, because on iOS the Customer.io SDK receives new tokens itself when it fetches tokens for you.

The event you forward depends on whether your app registers FCM tokens or [Firebase Installation IDs](https://docs.customer.io/integrations/sdk/react-native/whats-new/fid-migration/). React Native Firebase reports a new FCM token through `onTokenRefresh`. In FID mode, it calls `onRegistered` instead, so if you switch modes, update your listener too.

<!-- tabs -->

<!-- tab: FCM token -->

#### FCM token

```
import { useEffect } from 'react';
import { Platform } from 'react-native';
import { getMessaging, onTokenRefresh } from '@react-native-firebase/messaging';
import { CustomerIO } from 'customerio-reactnative';

// In a component that stays mounted, like your root App component:
useEffect(() => {
  if (Platform.OS !== 'android') {
    return;
  }

  const unsubscribe = onTokenRefresh(getMessaging(), token => {
    CustomerIO.registerDeviceToken(token);
  });

  return unsubscribe;
}, []);
```

<!-- /tab -->

<!-- tab: Firebase Installation ID -->

#### Firebase Installation ID

React Native Firebase added `onRegistered` in version 27.0.0. See [Migrate to Firebase Installation IDs](https://docs.customer.io/integrations/sdk/react-native/whats-new/fid-migration/) to learn how to use FID mode.

```
import { useEffect } from 'react';
import { Platform } from 'react-native';
import { getMessaging, onRegistered } from '@react-native-firebase/messaging';
import { CustomerIO } from 'customerio-reactnative';

// In a component that stays mounted, like your root App component:
useEffect(() => {
  if (Platform.OS !== 'android') {
    return;
  }

  const unsubscribe = onRegistered(getMessaging(), installationId => {
    CustomerIO.registerDeviceToken(installationId);
  });

  return unsubscribe;
}, []);
```

<!-- /tab -->

<!-- /tabs -->

## Option 2: Register Customer.io Messaging Service

You can register Customer.io’s messaging service in your `Manifest` file so that we handle all notifications for your app. You can do this by adding the following code under the `<application>` tag in the `AndroidManifest.xml` file in your app’s `android` folder.

```
<service
    android:name="io.customer.messagingpush.CustomerIOFirebaseMessagingService"
    android:exported="false">
    <intent-filter>
        <action android:name="com.google.firebase.MESSAGING_EVENT" />
    </intent-filter>
</service>
```

The Customer.io SDK will handle all your push notifications

The code above hands all push notifications responsibility to our SDK, meaning:

*   Your app will receive all simple and rich push notifications from Customer.io.
*   When your app is in the background, it can receive push notifications with a `notification` payload from other services.
*   Your app **cannot receive** `data`\-only push notifications from another service.

## Manually track push metrics

If you need to manually track push metrics when you use multiple push providers (like when you display notifications yourself or use another library), you can parse a push notification payload and send `opened` or `delivered` events to the SDK in relevant callbacks:

```
CustomerIO.trackMetric({
  deliveryID: deliveryID,
  deviceToken: deviceToken,
  event: MetricEvent.Opened,
});
```

The `trackMetric` method requires the following parameters:

*   `deliveryID`: The delivery ID extracted from the push notification payload
*   `deviceToken`: The device token extracted from the push notification payload
*   `event`: The metric event type, either `MetricEvent.Opened` or `MetricEvent.Delivered`
