I am trying to update an already delivered notification on iOS 10 which is a new feature. I am using an api call to send a push notification through firebase.
If a comes online notification should be "a is online" If b also comes online notification's message should be updated to "a and b are online" If c also comes online notification's message should be updated to "a,b and c are online" and so on..
I have used answer from this question How can I removed previously delivered notifications when a new notification arrives with UNUserNotificationCenterDelegate in iOS 10?. Whenever my backend sends a notification I wrote a logic in willPresentNotification to get the exact message needed and update an existing notification message.
But it only works only when the app is in foreground or background. If app is terminated then there is nothing in the frontend that can get executed to update the notification message. So every time backend sends a notification
I get "a is online", "b is online" and "c is online" all separate notifications.
So, how to get the desired behaviour from backend?? Do I have to save the identifiers of the notifications that I push, in the db and use them to update the message remotely?? Does iOS even allow a backend server to get the notification details from notification centre of a remote device?? If we use the identifier from backend will it update the message accordingly??
Thank you