Double notifications on Android (Always) & IOS (Sometimes)
See original GitHub issueFollowed the documentation to create a notification service extension for ios: https://notifee.app/react-native/docs/ios/remote-notification-support
Server side: I am using firebase-admin (node js) and sending message like this:
const title = "Hi"
const body = "How are you"
const data = {
type: "CHAT",
jobId: "1",
title,
body,
};
await getMessaging().sendMulticast({
tokens: tokenList,
data: data as any,
notification: {
title,
body,
},
apns: {
payload: {
aps: {
contentAvailable: true,
mutableContent: true,
sound: 'default',
},
notifee_options: {
title,
body,
data,
ios: {
foregroundPresentationOptions: {
alert: true,
badge: true,
sound: true,
},
},
},
},
},
});
notifications seem to be working fine on IOS (sometimes i get 2 notifications on ios as well) but on Android i am getting 2 notifications consistently when app is in the background. I am using notifee.displayNotification to display the notification in both android and ios.
I believe i am seeing 2 notifications because i am using notification option which gets displayed automatically and then setBackgroundMessageHandler handles the notification and data again and show another notification.
I can remove the notification option while sending a multicast message but then it will break the ios notification. Any suggestions will be much appreciated.
Issue Analytics
- State:
- Created 2 years ago
- Comments:15 (4 by maintainers)
Top Related StackOverflow Question
i used https://notifee.app/react-native/docs/ios/remote-notification-support
The complete message that worked me is:
Hello there, @sushilbansal, So you have closed the issue, did you manage to solve it? I am experiencing the same thing, would be interesting to hear what worked for you