Lyba Kashif
Lyba Kashif

Reputation: 155

Duplicate notifications with different sounds - push notification remote

I am trying to add the custom sound in the push notification. I have added the showNotification in the background handler on the client-side (flutter), but now when the application is in the background or terminated I receive duplicate notifications, one with default sound and the other with my custom sound. Can anyone tell me how to stop showing the default background notification?

Upvotes: 3

Views: 4679

Answers (1)

Victor Eronmosele
Victor Eronmosele

Reputation: 7696

You're getting the duplicate notification because

  1. you're sending a notification message and it is automatically displayed by the FCM SDK and,
  2. you're implementing a custom notification display yourself.

The solution is to send a data message instead of a notification message.

With FCM, you can send two types of messages to clients:

  • Notification messages, sometimes thought of as "display messages." These are handled by the FCM SDK automatically.
  • Data messages, which are handled by the client app.

Source

Upvotes: 9

Related Questions