Ad

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?

Ad

Answer

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

Ad
source: stackoverflow.com
Ad