I can successfully start a Live Activity using push-to-start token, but in order to update the Live Activity i need another token as stated in the docs:
While the system starts the new Live Activity and wakes up your app, you receive the push token you use for updates.
When the app is open, i can retrieve this update token and successfully update the Live Activity using this example code:
func observeActivityPushToken() {
Task {
for await activityData in Activity<LiveActivityAttributes>.activityUpdates {
Task {
for await tokenData in activityData.pushTokenUpdates {
let token = tokenData.map { String(format: "%02x", $0) }.joined()
print("Push token: \(token)")
}
}
}
}
}
But when the app is closed, how/where do i manage to get this update token and send it to the server "when the system wakes up the app"?