Robin Dijkhof
Robin Dijkhof

Reputation: 19288

flutter cloud messaging it is possible to modify notification title before displaying?

Let's say I'm sending a push notification to a mobile device with the title hello world. On the client, I am storing how many times the hello world notification has been sent. Let's assume the value is 3. Now upon receiving, I want to show in the notification title how many times the notification has been received. So the notification title would be hello world: 3.

Can this be achieved for (terminated) background notifications on Android and iOS?

Upvotes: 0

Views: 1077

Answers (1)

Frank van Puffelen
Frank van Puffelen

Reputation: 599521

If the message you send has a notification property, that message is handled by the system when the app is backgrounded. So in that case, you can't modify what is displayed to the user.

If you want to have an opportunity to change what (or even whether) is displayed to the user on the device, you should send a message with only a data property. Data-only messages are delivered to your application code, no matter if the app is in the foreground or in the background. Your application code can then display the notification message to the user.

Upvotes: 3

Related Questions