I am trying to implement push notifications in flutter, I am using firebase_messaging for that and flutter_local_notification to show notification when the app is in foreground.
I know the contents of the message sent by firebase it is as follows:
{ "message":{ "token":"token_1", "data":{}, "notification":{ "title":"FCM Message", "body":"This is an FCM notification message!", } } }
notification and data.
firebase_messaging creates notification automatically when notification is the part of the message when the app is background or terminated state.
There are two notification created by the FCM sdk itself and the flutter_local_notification plugin separately when the app is in background or terminated state, when both notification and data is sent from firebase console or from server.
I want to show the notification from the flutter_local_notification only due to the less customization available in the FCM sdk created notification for that the server is sending only data notification but the app is not able to catch it when the app is in background or terminated state (not running in background).
So, what I want is:
==> To prevent firebase_messaging from creating the notification when both data and notification is sent in the message from server or firebase console.
OR
==> To be able to catch the data only message from the server when the app is background or terminated state and show from the flutter_local_notification plugin.
Struggling through it from months please help.