flutterfire icon indicating copy to clipboard operation
flutterfire copied to clipboard

[firebase_messaging] Silent In-App Notifications Without Triggering Push Notification

Open RobertoPegoraro opened this issue 5 months ago • 1 comments

Following the ongoing discussion here, many developers in the community are requesting support for sending silent notifications that do not trigger a system push notification, enabling the implementation of native in-app notification centers (like an internal bell icon with a notification list).

Currently, it is only possible to deliver data-only messages silently when the app is in the foreground. However, when the app is in the background or terminated, silent messages do not reliably arrive, and if a notification payload is included, a system push notification is automatically shown, which is undesirable.

Here are some examples illustrating the current behavior - It creates a push notification — working as expected.:

'message': {
  'token': token,
  'notification': notification,
  'data': data,
}

In-APP:

'message': {
  'token': token,
  'data': data,
}

It works as an in-app message but only when the app is opened (foreground).

As we know, FCM only delivers messages with the app in background if there is a 'notification' object. So, we need a way to intercept the notification before it is presented as a push notification.

For example:

'message': {
  'token': token,
  'notification': notification,
  'data': {
    'type': 'in-app'
  },
}

In this example, I want to send a notification to all of my users, but before showing the usual push notification, I want to intercept it and — if the message is marked as 'in-app' — prevent the push from showing, store the notification locally in a database, and display it only inside the app’s internal notification center.

This feature is critical to support modern UX patterns where users receive non-intrusive updates while avoiding notification spam and providing a unified in-app notification experience.

Thank you for considering this enhancement! Looking forward to your thoughts.

RobertoPegoraro avatar Jul 03 '25 13:07 RobertoPegoraro