---
updatedAt: 2026-07-28T10:31:50.000Z
agentTools:
  siteIndex: https://documentation.bloomreach.com/llms.txt
  projectIndex: https://documentation.bloomreach.com/engagement/llms.txt
---

# Push notifications for Flutter SDK

Enable push notifications in your app using the Flutter SDK

Marketing enables sending push notifications to your app users using [scenarios](https://documentation.bloomreach.com/engagement/docs/scenarios-1). The mobile application handles the push message using the SDK and renders the notification on the customer's device.

Push notifications can also be silent, used only to update the app’s interface or trigger some background task.

> 📘
>
> Refer to [Mobile push notifications](https://documentation.bloomreach.com/engagement/docs/mobile-push-notifications#creating-a-new-notification) to learn how to create push notifications in the Marketing web app.

> 📘
>
> Also see [Mobile push notifications FAQ](https://support.bloomreach.com/hc/en-us/articles/18152713374877-Mobile-Push-Notifications-FAQ) at Bloomreach Support Help Center.

## Integration

The Flutter SDK relies on the underlying native Android and iOS platforms to handle push notifications. Use the checklist below to complete all required setup steps for both platforms.

### Push notifications integration checklist

Complete these steps in order to ensure reliable push notification delivery and accurate event tracking.

1. **Set up native platform dependencies**
   * [ ] Ensure your Flutter project is configured for both Android and iOS native integrations.

2. **Android integration**
   * [ ] Set up a Firebase project and add the `google-services.json` file to your Android project. Refer to the [Firebase Cloud Messaging guide](https://documentation.bloomreach.com/engagement/docs/android-sdk-firebase) for step-by-step instructions.
   * [ ] Implement Firebase messaging by registering a `FirebaseMessagingService` subclass in your app.
   * [ ] Configure the Firebase Cloud Messaging integration in the Marketing web app.
   * [ ] Grant notification permission at runtime (required for Android 13+, API level 33+).
   * [ ] Follow all steps described in the [Android push notifications for Flutter SDK](https://documentation.bloomreach.com/engagement/docs/flutter-sdk-push-android).

3. **iOS integration**
   * [ ] Obtain an Apple Push Notification service (APNs) authentication token signing key.
   * [ ] Add and configure the APNs integration in the Marketing web app.
   * [ ] Enable push capabilities, background modes, and app groups in your app using Xcode.
   * [ ] Extend your app's `AppDelegate` with `ExponeaFlutterAppDelegate` to handle push notification events.
   * [ ] Request notification permission on application startup.
   * [ ] Complete the setup steps in the [iOS push notifications for Flutter SDK](https://documentation.bloomreach.com/engagement/docs/flutter-sdk-push-ios).

4. **SDK self-check (optional but recommended)**
   * [ ] Before initializing the SDK, call `ExponeaPlugin().checkPushSetup()` on each platform to verify a successful push setup.

5. **Test your implementation**
   * [ ] Send test push notifications from the Marketing web app and confirm delivery, receipt, and interaction tracking in your app.
   * [ ] Register listeners (`openedPushStream`, `receivedPushStream`) to handle notification interactions and delivery events.

6. **Refer to platform-specific documentation**
   * [ ] For advanced configuration, troubleshooting, or additional features, consult:
     * [Android (Firebase) setup guide](https://documentation.bloomreach.com/engagement/docs/android-sdk-firebase)
     * [iOS push notifications for Flutter SDK](https://documentation.bloomreach.com/engagement/docs/flutter-sdk-push-ios)
     * [Push notifications for Flutter SDK](https://documentation.bloomreach.com/engagement/docs/flutter-sdk-push-notifications) for customization, deep linking, and event tracking.

### Platform-specific integration guides

The following pages describe the steps for each platform to add the minimum push notification functionality (receive alert notifications) to your app:

* [Android push notifications for Flutter SDK](https://documentation.bloomreach.com/engagement/docs/flutter-sdk-push-android)
* [iOS push notifications for Flutter SDK](https://documentation.bloomreach.com/engagement/docs/flutter-sdk-push-ios)

## Customization

This section describes the customizations you can implement once you have integrated the minimum push notification functionality.

### Configure automatic push notification tracking

By default, the SDK tracks push notifications automatically. The SDK will display push notifications from Marketing and track a "campaign" event for every delivered/opened push notification with the relevant properties.

In the [Configuration for Flutter SDK](https://documentation.bloomreach.com/engagement/docs/flutter-sdk-configuration), you can set the desired frequency with which the SDK tracks the push notification token to Marketing using the `pushTokenTrackingFrequency` property (default value is `TokenFrequency.onTokenChange`).

On Android, you can disable automatic push notification tracking by setting the Boolean value of the `automaticPushNotifications` property to `false` in the SDK's [Configuration for Flutter SDK](https://documentation.bloomreach.com/engagement/docs/flutter-sdk-configuration#android-specific-configuration-parameters) (Android-specific configuration).

> ❗️Important
>
> * The Flutter SDK currently doesn't support disabling automatic push notification tracking on iOS.
> * SDK versions 2.3.0 and higher use event-based token tracking to support multiple mobile applications per project. Learn more about [Token tracking via notification\_state event](#token-tracking-via-notification_state-event).

### Respond to push notification interactions

Once you have followed the integration steps for each platform, your app should be able to receive push notifications.

To respond to a push notification interaction, you can set up a listener to `ExponeaPlugin().openedPushStream`:

```dart
import 'package:exponea/exponea.dart';

final _plugin = ExponeaPlugin();
final subscription = _plugin.openedPushStream.listen((openedPush) {
  switch(openedPush.action) {
    case PushActionType.app:
      // last push directed user to your app with no link

      // log data defined on Exponea backend
      print('app - ${openedPush.data}'); 
      break;
    case PushActionType.deeplink:
      // last push directed user to your app with deeplink
      print('deeplink - ${openedPush.url}');
      break;
    case PushActionType.web:
      // last push directed user to web, nothing to do here
      print('web');
      break;
  }
});
```

Call `subscription.cancel()` when you no longer need the listener.

We recommend registering the listener as soon as possible to ensure proper application flow. However, the SDK will hold the last push notification and call the listener once it's registered.

> ❗️
>
> To support deep links, additional set up steps are required. Refer to the documentation for the respective native platforms ([Android push notifications for Flutter SDK](https://documentation.bloomreach.com/engagement/docs/flutter-sdk-push-android), [iOS push notifications for Flutter SDK](https://documentation.bloomreach.com/engagement/docs/flutter-sdk-push-ios)). Alternatively, use the `Open app` action instead and add your payload to `Additional data`.

### Respond to received push notifications

You can set up a listener for received push notifications using `ExponeaPlugin.receivedPushStream`, which is especially useful for silent push notifications.

```dart
final subscription = _plugin.receivedPushStream.listen((receivedPush) {
  print(receivedPush);
});
```

Call `subscription.cancel()` when you no longer need the listener.

We recommend registering the listener as soon as possible to ensure proper application flow. However, the SDK will hold the last push notification and call the listener once it's registered.

> ❗️
>
> The listener is called for both regular and silent push notifications on Android but **only** for silent push notifications on iOS due to technical limitations.

### Manually track push notifications

If you disable [automatic push notification tracking](#configure-automatic-push-notification-tracking) (Android only) or if you want to track push notification from other providers, you can manually track events related to push notifications.

> ❗️
>
> The Flutter SDK currently doesn't support disabling automatic push notification tracking on iOS.

#### Track push token (FCM)

Use the `trackPushToken` method to manually track the FCM push token:

```dart
ExponeaPlugin().trackPushToken("382d4221-3441-44b7-a676-3eb5f515157f")
```

Invoking this method will track the push token immediately regardless of the [Configuration for Flutter SDK](https://documentation.bloomreach.com/engagement/docs/flutter-sdk-configuration) for `pushTokenTrackingFrequency`.

> ❗️Important
>
> SDK versions 2.3.0 and higher use event-based token tracking to support multiple mobile applications per project. Learn more about [Token tracking via notification\_state event](#token-tracking-via-notification_state-event).

#### Track delivered push notification

Use the `trackDeliveredPush` method to manually track a delivered push notification:

```dart
final Map<String, dynamic> payload = {
  "platform": "android",
  "subject": "subject",
  "type": "push",
  "url_params": {
    "utm_campaign": "Campaign name",
    "utm_medium": "mobile_push_notification",
    "utm_content": "en",
    ...
  },
  ...
};
ExponeaPlugin().trackDeliveredPush(payload)
```

> ❗️
>
> The behaviour of `trackDeliveredPush` may be affected by the tracking consent feature, which, when enabled, requires explicit consent for tracking. Read more in the [Tracking consent for Flutter SDK](https://documentation.bloomreach.com/engagement/docs/flutter-sdk-tracking-consent).

#### Track clicked push notification

Use the `trackClickedPush` method to manually track a clicked push notification:

```dart
final Map<String, dynamic> payload = {
  "platform": "android",
  "subject": "subject",
  "type": "push",
  "url_params": {
    "utm_campaign": "Campaign name",
    "utm_medium": "mobile_push_notification",
    "utm_content": "en",
    ...
  },
  ...
};
ExponeaPlugin().trackClickedPush(payload)
```

> The behaviour of `trackClickedPush` may be affected by the tracking consent feature, which, when enabled, requires explicit consent for tracking. Read more in the [Tracking consent for Flutter SDK](https://documentation.bloomreach.com/engagement/docs/flutter-sdk-tracking-consent).

### Custom push notification data processing

If the provided native `ExponeaModule.Companion.handleRemoteMessage` (Android) and `ExponeaNotificationService().process` (iOS)  methods don't fit the requirements of your app, or you decide to disable automatic push notifications, you must handle push notifications and process their payload yourself.

Notification payloads are generated from (possibly complex) scenarios in the Marketing platform and contain all data for Android, iOS and web platforms. Therefore, the payload itself can be complex.

Notification payloads use a JSON data structure.

#### Payload example

```json
{
    "notification_id": 123,
    "url": "https://example.com/main_action",
    "title": "Notification title",
    "action": "app|browser|deeplink|self-check",
    "message": "Notification message",
    "image": "https://example.com/image.jpg",
    "actions": [
        {"title": "Action 1", "action": "app|browser|deeplink", "url": "https://example.com/action1"}
    ],
    "sound": "default",
    "aps": {
        "alert": {"title": "Notification title", "body": "Notification message"},
        "mutable-content": 1
    },
    "attributes": {
        "event_type": "campaign",
        "campaign_id": "123456",
        "campaign_name": "Campaign name",
        "action_id": 1,
        "action_type": "mobile notification",
        "action_name": "Action 1",
        "campaign_policy": "policy",
        "consent_category": "General consent",
        "subject": "Subject",
        "language": "en",
        "platform": "ios|android",
        "sent_timestamp": 1631234567.89,
        "recipient": "user@example.com"
    },
    "url_params": {"param1": "value1", "param2": "value2"},
    "source": "xnpe_platform",
    "silent": false,
    "has_tracking_consent": true,
    "consent_category_tracking": "Tracking consent name"
}
```

## Token tracking via notification\_state event

Starting with SDK version 2.3.0, push notification tokens are tracked using `notification_state` events instead of customer
profile properties. This change enables support for multiple mobile applications per project,
allowing you to track multiple push tokens for the same customer across different apps and devices.

### Token storage by SDK version

#### SDK versions below 2.3.0:

* Tokens are stored in customer profile properties: `google_push_notification_id`, `huawei_push_notification_id`, or `apple_push_notification_id`
* One token per customer profile
* Single application per project

#### SDK versions 2.3.0 and higher:

* Tokens are stored as `notification_state` events
* Multiple tokens per customer (grouped by Application ID)
* Multiple applications per project supported
* Backward compatibility maintained for Application ID `default-application`

### When notification\_state events are tracked

The SDK automatically tracks `notification_state` events in the following scenarios:

* SDK initialization
* App transitions from background to foreground (only if notification permission status has changed since last tracking)
* SDK version changes (app update)
* `applicationId` changes in the SDK configuration
* New token received from Firebase, Huawei, or APNs
* Manual token tracking using `ExponeaPlugin().trackPushToken(...)` (Android, iOS) or `ExponeaPlugin().trackHmsPushToken(...)` (Huawei) — lets you force tracking/sending the current push token via `notification_state` event
* User anonymization via `ExponeaPlugin().anonymize()` or `ExponeaPlugin().stopIntegration()`
* OS push authorization status flips (granted ↔ denied) since the last `notification_state` event, so the `valid` flag always stays in sync with the user's actual permission state
* 30 days have passed since the last successful `notification_state` track (applies to `ON_TOKEN_CHANGE` frequency, ensuring the token stays within the validity window even when it hasn't changed)
* Notification permission requested via `ExponeaPlugin().requestPushAuthorization()`

```dart
_plugin.requestPushAuthorization()
.then((accepted) => print("User has ${accepted ? 'accepted': 'rejected'} push notifications."))
.catchError((error) => print('Error: $error'));
```

The frequency of `notification_state` event tracking depends on the `pushTokenTrackingFrequency` configuration property. See [Configuration for Flutter SDK](https://documentation.bloomreach.com/engagement/docs/flutter-sdk-configuration).

> 📘 Note
>
> When `pushTokenTrackingFrequency` is `TokenFrequency.onTokenChange` (the default), the SDK also refreshes the `notification_state` event every 30 days, even when the token hasn't changed.

> 📘 Note
>
> When `pushTokenTrackingFrequency` is `TokenFrequency.everyLaunch`, the SDK tracks the push token once per app launch (process start). All other SDK operations during that launch reuse this tracking, so each launch produces a single `notification_state` event.
>
> Some operations bypass this limit and always trigger tracking:
>
> * Calling `ExponeaPlugin().trackPushToken(...)` or `ExponeaPlugin().trackHmsPushToken(...)` manually.
> * Receiving a new token from FCM, HMS, or APNs.
> * Calling `ExponeaPlugin().anonymize()` or `ExponeaPlugin().stopIntegration()`.

### notification\_state event properties

| Property                  | Description                                   | Example values                                              |
| ------------------------- | --------------------------------------------- | ----------------------------------------------------------- |
| `push_notification_token` | Current push notification token               | Token string                                                |
| `platform`                | Mobile platform                               | `android`, `huawei`, or `ios`                               |
| `valid`                   | Token validity status                         | `true` or `false`                                           |
| `description`             | Token state description                       | `Permission granted`, `Permission denied`, or `Invalidated` |
| `application_id`          | Application identifier from SDK configuration | Custom ID or `default-application` (default)                |
| `device_id`               | Unique device identifier                      | UUID string                                                 |
| `os_name`                 | Operating-system name                         | `Android`, `iOS`                                            |
| `os_version`              | Operating-system version                      | `14`, `17.4`                                                |
| `sdk`                     | SDK identifier                                | `Exponea Android SDK`, `Exponea iOS SDK`                    |
| `sdk_version`             | Version of the native Bloomreach SDK           | `5.2.1`, `4.2.0`                                            |
| `device_model`            | Device model name                             | `Pixel 8`, `iPhone 15 Pro`                                  |
| `device_type`             | Device form factor                            | `mobile`, `tablet`                                          |
| `app_version`             | Host app version                              | `1.0`, `2.3.1`                                              |

> 📘 Note
>
> If you don't specify an `applicationId` in your SDK configuration, the SDK uses the default value `default-application`. For more details, see [Configuration for Flutter SDK](https://documentation.bloomreach.com/engagement/docs/flutter-sdk-configuration).

### Understanding token states

The combination of `valid` and `description` properties indicates the token's current state:

| Valid   | Description          | When this occurs                                                                                                                                                                                        |
| ------- | -------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `false` | `Invalidated`        | New token received (old token becomes invalid) or `ExponeaPlugin().anonymize()` / `ExponeaPlugin().stopIntegration()` called                                                                            |
| `false` | `Permission denied`  | User denied notification permission or the user disabled notifications in system settings. The `valid` flag reflects the actual OS permission state directly, regardless of `requirePushAuthorization`. |
| `true`  | `Permission granted` | User has granted notification permission and notifications are enabled                                                                                                                                  |

### Configuring Application ID

> 📘 Note
>
> To configure `applicationId`, see [Configure application ID](https://documentation.bloomreach.com/engagement/docs/flutter-sdk-setup#configure-application-id).

> ❗️Important
>
> The SDK can automatically generate `notification_state` events,
> but your Marketing project must have event creation enabled. If your project uses custom event schemas
> or restricts event creation, add `notification_state` to the list of allowed events. Otherwise, push token registration will fail silently.

### Verifying token tracking

You can verify that tokens are being tracked correctly in the Marketing web application:

1. Navigate to Data & Assets > Customers
2. Locate the customer profile
3. Check for `notification_state` events in the customer's event history
4. Verify the `push_notification_token` property contains a valid token value

For SDK versions below 2.3.0, check the customer profile properties `google_push_notification_id`, `huawei_push_notification_id`, or `apple_push_notification_id`.