Does Live Activity always receive updates for pushToStartTokenUpdates and activityUpdates?

Our context involves smart kitchen appliances, where cooking may be initiated by an app or directly by the device. When the app is not running, we can only start a Live Activity through a remote push notification. However, an increasing number of users report issues where they cannot update or terminate the Live Activity. While we can reproduce this issue in some cases, it is inconsistent and lacks a clear pattern. I have a sample project and would like to confirm the following questions:

  1. When the app is not running, does each pushToStartToken update wake the app and reliably trigger the callback below?
for await pushToken in Activity<DeviceAttributes>.pushToStartTokenUpdates {
}
  1. When the app is not running, does each pushTokenUpdates update wake the app and reliably trigger the callback below?
Task {
for await activity in Activity<DeviceAttributes>.activityUpdates {
Task {
for try await tokenData in activity.pushTokenUpdates {
}
}
}
}
  1. Must pushToStartTokenUpdates and pushTokenUpdates be placed directly in application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?), or can they be in another wrapper, such as an RxSwift wrapper?

  2. If pushTokenUpdates is updated, but the received pushToken fails to synchronize to the server due to network issues, how should this be handled?

Alternatively, if you have any better suggestions, I would be very grateful to hear them.

Here is a simple example.

Hi,

This will wake your process in the background each time a new token is sent to your device, you can at that point persist it locally or even to a server that you control.

For 1) I don't know about RXSwift but you can have your file's target membership include your app and extension process if needed.

For 2) I'd persist locally with a timestamp and compare to your server token to know if there was a failure. You won't be able to keep the process open forever to retry so a local mechanism will also be useful.

Rico


WWDR | DTS | Software Engineer

Does Live Activity always receive updates for pushToStartTokenUpdates and activityUpdates?
 
 
Q