iOS Swift 3 Bundle Notification
Asked Answered
A

1

2

In My App I am using firebase push notification. Problem is when user connected to internet after long time they will receive lot of notifications as individual notification. Is it Possible to Receive Notification like whatsapp(You have 10 New Notification). If user receives more than 1 notification at a time means we need to make it as Group or Bundle notification.

Ashlaring answered 24/2, 2017 at 8:9 Comment(0)
S
1

Update: apns-collapse-id is already available for FCM v1:

FCM provides a specific set of delivery options for messages sent to Android devices, and allows for similar options on iOS and web. For example, "collapsible" message behavior is supported on Android via FCM's collapse_key, on iOS via apns-collapse-id, and on JavaScript/Web via Topic. For details, see descriptions in this section and related reference documentation


In order to bundle notifications in iOS, you'll have to specify a thread-id:

Provide this key with a string value that represents the app-specific identifier for grouping notifications. The system groups notifications with the same thread identifier together in Notification Center and other system interfaces. For local notifications, this key corresponds to the threadIdentifier property of the UNNotificationContent object.

However, there is currently no parameter counterpart for thread-id in FCM. What you could try and do is make use of a data message payload and specify the thread-id as a custom key-value pair.

Some possibly helpful posts:

Spessartite answered 24/2, 2017 at 8:24 Comment(8)
how you can use data message payload ? because as soon as the phone will get the internet it's will show all the pending message and the app will be not even launched at this timeSuave
I had added the thread_id to the data payload but it did nothing. Still the notifications not replacing themselvesJargonize
@DanielRaouf I'm presuming the recent downvote was yours? The thread_id is a custom parameter (pretty much anything you add in the data payload is a custom key-value pair). Just adding it in your payload doesn't mean that the client would handle it automatically. You have to handle it on your own.Spessartite
When the app is killed you can't control the notifications that shows up in Ios from the ios app itself. so doing anything would be uselessJargonize
@DanielRaouf That's a restriction on iOS, not with FCM. I don't see how my answer is worth the downvote because of a limitation not directed to the answer though.Spessartite
@Spessartite I will remove the downvote but please tell me first what other push notifications platforms (other than FCM) that support the thread_id without a work around. Thank YouJargonize
@DanielRaouf That's not how Stack Overflow works. If you have a different question that is related to programming and is not directly about a post you're commenting about, you should Ask a Question. It's highly unlikely that you'll be able to retract the downvote now. That option is only available a few minutes after the giving the vote. Moving forward, I hope that you ask in the comment section and wait for the response first before actually downvoting any other posts.Spessartite
@DanielRaouf: your explanation for thread_id , and You have to handle it on your own is very unclear. I appreciate if you could elaborate on that. Is this even possible with FCM or not, and if so, how would you handle it on your own?Kalmia

© 2022 - 2024 — McMap. All rights reserved.