I’m developing an App with the Plugin.Firebase
that involves receiving notifications with data passed in the data fields, for example:
var message = new Message()
{
Notification = new Notification()
{
Title = "My Title",
Body = "My Body"
},
Data = new Dictionary<string, string>()
{
{"Type",XXX},
{"A",XXX},
},
Topic = "XXXX"
};
Based on the App’s Default language, the Body will contain Field A instead of the original Body (“My Body”).
All this works correctly if the App is in the foreground, if it is in stand-by or is not in memory, the Original Body is always shown.
The FirebaseMessagingService
OnMessageReceived
Event appears not to be invoked.
Is it possible?
There is a different approach to managing background notifications?
TonySoft is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
This is the expected behavior: when the user is not actively using your app, the system will show the notification. If you don’t want that behavior, send messages without a notification
property – so-called data-only messages.
Also see the Firebase documentation on message types, which explains this distinction too.