invertase / react-native-notifee

Moved to https://github.com/invertase/notifee
https://invertase.io/blog/open-sourcing-notifee
Other
465 stars 31 forks source link

Update messages in conversation notification #369

Closed adar2378 closed 3 years ago

adar2378 commented 3 years ago

Hi, I'm trying to implement MessagingStyle notification for android. What would be the best option to update existing notification with newer messages? Or should I cancel the previous notification of the same conversation and create a new one with updated messages? Thanks in advance.

mikehardy commented 3 years ago

I believe they lead to different user experiences, cancel/notify leads to all of the alerts and lights and such again, update is less intrusive as the notification doesn't do all the alerts again. It's a choice depending on use case I think

adar2378 commented 3 years ago

Thank you for your response. I could not seem to find any API for updating an existing notification. Could you provide some guidance on how should I update a notification?

mikehardy commented 3 years ago

https://notifee.app/react-native/reference/displaynotification

API used to immediately display or update a notification on the users device.

Returns a string (the id), then:

https://notifee.app/react-native/reference/notification#id

Notifications with the same ID will be created as the same instance, allowing you to update a notification which already exists on the device.

I believe that's the ticket. If those don't work we can reopen and troubleshoot

adar2378 commented 3 years ago

Thank you very much! I'll try that.