---
title: "Flutter SDK: Push notifications"
description: "Set up push notifications for customer messages with the Gleap Flutter SDK. Follow the integration code examples."
url: https://docs.gleap.ai/en/articles/537-flutter-sdk-push-notifications
collection: "Flutter"
updated: 2026-11-01
language: en
---

# Flutter SDK: Push notifications

Set up push notifications for customer messages with the Gleap Flutter SDK. Follow the integration code examples.

Stay connected with your customers by utilizing push notifications to alert them of new chat messages, release notes, and news articles. This will deepen engagement and foster stronger relationships.

Gleap supports [Firebase Cloud Messaging](https://firebase.google.com/docs/cloud-messaging) to send push notifications to users.

## Setup Firebase Cloud Messaging

To make use of Gleap Push Notifications you must add the Firebase Cloud Messaging service to your app or website. Learn how to get started with FCM [here](https://firebase.google.com/docs/cloud-messaging).

## Getting your Firebase Cloud Messaging Token

Open your project in Firebase and open the project settings.

Click on "Cloud Messaging" and, if it is not already enabled, activate the Firebase Cloud Messaging API (V1).

![Firebase Cloud Messaging API v1 settings in the existing example project.](https://staticfiles.gleap.io/p613b5dd730aed737108f87ab/EXsrhvuamORx0xa4YtpmZJLx4XMOleKSVb6TBLALNylbZ14MDv1sYjLjJyqQKq2vtu3fAsIo4uf.png)

Proceed to the "Service Accounts" section and generate a new private key, which will automatically create a file named like `serviceAccountKey.json`.

![Firebase service-account setup in the existing example project. No private key is displayed.](https://staticfiles.gleap.io/p613b5dd730aed737108f87ab/3L6WWg4TfpUDuiPLiyLesRpKNB76FF1eO4geLNXJnFQPDCnJqHFf0jyWRy7EArmsw8yjT2uITrs.png)

In Gleap, open Settings → Developer → Push notifications and upload the Firebase service-account JSON file. Keep the file private; it authorizes push delivery for the Firebase project.

![Push notification service-account file upload. No credential is shown.](https://staticfiles.gleap.io/p613b5dd730aed737108f87ab/P0ExxlppVbgauOrnK6goEgpy9DwTz5Ov3oHyxwBLNQNVfiXkOmA5Fs7cHQPhzZnopvdi2bMl7dL.png)

## Subscribe to the Gleap user topic

The last step to complete the push notification setup is to subscribe to the user topic, which Gleap will send the push notifications to. In order to do so, you will need to register the register & unregister push message topic callbacks.

```dart
// Find more information here:
// https://pub.dev/packages/firebase_messaging

Gleap.registerPushMessageGroup(callbackHandler: (String topic) {
  FirebaseMessaging.instance.subscribeToTopic(topic);
});

Gleap.unregisterPushMessageGroup(callbackHandler: (String topic) {
  FirebaseMessaging.instance.unsubscribeFromTopic(topic);
});
```

> **Info:** Please note that these callbacks should be called before initializing Gleap.

## Handle push-notifications click

To handle push notifications, you will need to register a callback handler for the `onMessage`, `onMessageOpenedAppHandler` and `onBackgroundMessageHandler` callbacks.

```dart
  static Future<void> onMessageOpenedAppHandler(RemoteMessage message) async {
    if (message.data['sender'] == 'GLEAP') {
      Gleap.handlePushNotification(data: message.data);
    }
  }
```

That's it - build and run your app 🚀

## Notification images

When a changelog or news article with a featured image is sent as a push notification, Gleap includes the image in the FCM payload.

-   **Android** displays the image automatically when the notification arrives while your app is in the background — no setup required.
    
-   **iOS** requires a Notification Service Extension in your app to display the image. Follow the native setup in the [iOS push notification guide](https://gleap-developer-docs.gleap.help/en/articles/441-ios-sdk-push-notifications#notification-images) — the extension is added to the iOS project in Xcode and works unchanged in a Flutter app.

## Related

- [Flutter SDK setup](https://docs.gleap.ai/en/articles/531-flutter-sdk-setup.md)
- [Flutter SDK: User identity](https://docs.gleap.ai/en/articles/532-flutter-sdk-user-identity.md)
- [Flutter SDK: Track events](https://docs.gleap.ai/en/articles/533-flutter-sdk-track-events.md)
- [Flutter SDK: Track pages](https://docs.gleap.ai/en/articles/534-flutter-sdk-track-pages.md)
- [Flutter SDK: Frontend tools](https://docs.gleap.ai/en/articles/535-flutter-sdk-frontend-tools.md)
