I am trying to collapse/merge multiple notifications belonging to same event in my app. iOS 10 introduced a key name apns-collapse-id in payload. Document says multiple remote notifications with same apns-collapse-id
will merged and shown as single notification.
So we have the payload with apns-collapse-id
and thread-id
in our notification payload. Unfortunately as there is no much content online explaining how these keys actually works, for safe play we have used the same unique value for both apns-collapse-id
and thread-id
.
We are expecting the multiple remote notifications with same apns-collapse-id
to merge. It is not happenning.
Few people suggested APNS collapse does not come for free and I have to implement UNNotificationContentExtension
and handle the notifications manually. I know I can add and remove local notification already posted but not really sure how to update the already posted remote notification.
Here is how our payload looks like
payload {
"aps": {
"alert": {
"title": "Some title : ",
"body": "Some body text"
},
"sound": "default",
"payload": {
"target": {
"some key" : "Some value"
},
"thread_id": "Some_string_155863",
},
"apns-collapse-id": "Some_string_155863",
"mutable-content": 1,
"thread-id": "Some_string_155863",
"badge": 33
},
"thread-id": "Some_string_155863",
"apns-collapse-id": "Some_string_155863",
"mutable-content": 1
}
as you can see apns-collapse-id and thread-id are repeated multiple times in JSON because we aren't sure where exactly to have them
We are not using HTTPS/2 yet, but I believe iOS 10 notfication still supports legacy HTTPS. I am not really a network guy so I don't understand these things completely. Ignore my arrogance towards Https and Http2
Has anybody managed to get apns-collapse-id to work ? Please help.
You can fix an iPhone that's not getting notifications by restarting it or making sure notifications are turned on. You should also make sure your iPhone is connected to the internet so apps can receive notifications. If all else fails, you should try resetting the iPhone — just make sure to back it up first.
The APNs request header key for the collapse identifier is apns-collapse-id and is defined in Table 6-2. For example, a news service that sends the same headline twice in a row could employ the same collapse identifier for both push notification requests.
Sending a test Android push notificationClick on Settings and open Mobile Apps. Click on the Android App and make sure the Firebase API key has been configured. Click on Test Push and enter the device token for your test device. Add a test payload and send the test.
Rich push notifications are short pop-up messages sent to a user's device with a rich media attachment such as an animated GIF, video, or audio. They allow you to communicate with your customers in an inviting way even when they're not actively using your app or visiting your website.
apns-collapse-id
is a request header, so you need to use the HTTP service and not the legacy binary interface.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With