-
Notifications
You must be signed in to change notification settings - Fork 4k
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
[firebase_messaging] Disable interception of notification to allow for local notification generation #7874
Comments
Have you already found any solution? @Minituff |
@coccyx-cyst No I haven't yet. The latest update I've found on a solution is here: |
Same issue |
Facing the same issue. I want to add some customisations to notifications but turns out we can not customise background notifications. And if we try to launch our own custom notification then there are duplicates as there is no way to disable default background notifications. My ask is, please provide a flag to disable triggering of automatic background notifications and let user create his own. |
Hi @Minituff, there is no way of changing the system behaviour, it will always display a notification is it is present on the payload. You can increase the "low priority" aspect to data only payloads by doing the following: On Android, set the priority field to high. |
" If this is not possible, then I would love to see ActionButtons and Input fields come to the firebase_messaging plugin." |
@russellwheatley there would be a way. We should include mutable-content in payload and fcm should support it by coding this workaround https://developer.apple.com/documentation/usernotifications/modifying_content_in_newly_delivered_notifications Was thinking this might be related to our #9300. As reported in #9315 #9300, it seems that silent notifications wont be triggered on device if app is terminated AND app is not the last one used from user. Apple allows to modify the content of a remote notification though above feature in order to let developers use “notification” instead of (or along with) “data” and do sensitive things like decrypting the payload. |
To recap issue is: Silent notifications let developers manipulate the content before showing head ups. Unfortunately they are not reliable on iOS which deliver them with low priority The result is that they dont work well when app is terminated and they might not be triggered under many conditions even in foreground/background mode. Remote notifications are always delivered with highest priority and triggered in all app states: foreground / background / terminated. However, as of now, firebase_messaging displays them instantly and prevents developers from editing its content. This feature is key for chat apps which need to decrypt notifications’ payload before displaying it. Solution is to support content-mutable:1 inside payload and let developers edit payload fields even for “notification”, not just “data”. |
Discussed in #6113
Originally posted by Minituff May 11, 2021
Background
I am trying to create a chat app which delivers reliable notifications that includes action buttons such as
Mark as Read
andReply
which creates an input field.Unfortunately the
firebase_messaging
plugin does not support advanced options like Action/Input buttons. So, to do this in Flutter, I am using a great package called AwesomeNotifications which allows for all these advanced features. For anyone unfamiliar, it is like a more advanced version of the Local Notifications plugin.Using this plugin, I am able to handle the
FirebaseMessaging.onBackgroundMessage(_fcmBackgroundHandler);
callback fromfirebase_messaging
and generate the notification with all the properties and actions that I like.The Problem
If the notification includes the
notification
property thenfirebase_messaging
will automatically display the notification and AwesomeNotifications will then display its notification--resulting in duplicate notifications.However, removing the
notification
property turns it into adata-only
notification which, according to the FlutterFire docs are low-priority`I have also tested this with my own IOS and Android devices and I would not receive data-only messages unless the app was in the foreground or the last used app on IOS. Notifications would not come through if I was using another app, or it was swiped away from recents.
For a chat application, getting reliable messages is a priority and therefore I need to use the
notification
property to ensure delivery of my notifications. The issues:notification
property is set. However, thenotification
property is required for reliable notifications.firebase_messaging
plugin does not support advanced features such as Action/Input buttons.A greater explanation of (number 1):
firebase_messaging
automatically intercepts notifications and displays them and I don't think there is a way to disable that. Per the docs below:The Feature Request
I would like to be able to disable the
firebase_messaging
automatic notification display while still having theonBackgroundMessage
callback fire. This way I can send reliable notifications (with thenotification
property) and have them be displayed by the more advanced flutter tools.If this is not possible, then I would love to see ActionButtons and Input fields come to the
firebase_messaging
plugin.Additional Infromation
I created another issue here https://github.com/rafaelsetragni/awesome_notifications/issues/165
The text was updated successfully, but these errors were encountered: