In some cases Live Activity "get frozen" and no updates

666 Views Asked by At

In the latest application update we’ve provided users with ability to receive live updates for Football matches using Live Activities. Our application supports up to 5 simultaneous activities (one per match) and all the updates can be provided exclusively with ActivityKit push notifications. The average frequency of updates is about 10 per hour.

Mostly all the notifications can be received and handled properly on the client side, but in some cases Live Activity “get frozen” and no updates can be delivered for such Activity anymore. The key point here is that our Push Notification Server continues to send relevant match updates to APNS and receives 200 OK response but for unknown reason the notifications never get delivered to the client. Another detail to be mentioned is that we use traditional Push Notifications alongside with Live Activities and they work as expected without any troubles.

We’ve conducted a detailed analysis of the problem, read all available documentation but still couldn’t resolve the issue. The first thing we tried - adding NSSupportsLiveActivitiesFrequentUpdates entry to Info.plist. Thereby frequentPushesEnabled are constantly enabled and never turned off. Another trick we applied was setting apns-priority HTTP header for our requests to APNS. We have tried priority of 10 for important Live Activity updates and 5 for secondary ones in many different combinations.

All the described solutions were found in the Official Documentation.

During all the tests Low Power mode was disabled, Live Activities when iPhone is locked were allowed.

It’s worth to be mentioned that when the updates our Push Server sent to APNS weren’t delivered to iOS client, we tried to perform exactly the same request from our local machine. In this case APNS delivered the ActivityKit push notification immediately although Live Activity token and push payload were exactly the same.

According to this document, our push server generates new token to access APNS every 40 minutes, so reaching APNS with the expired JWT is probably not the case neither.

1

There are 1 best solutions below

0
On

we have recently encountered a similar issue. We experimented with the case that the user's device is without network connectivity, When pushing the message, although the message from the server reaches the APNs and the returned status is 200, the message is not successfully pushed to the user's device. We found that changing the value of an invalidationTime of the server code could solve this problem. The value of our field was set to a very short time, which caused the message to expire very quickly. We changed it to a longer time, which solved the problem in this case. Of course, this is only one of the cases, there may be some other cases that can cause the update to fail, which needs further investigation.