I'm trying to get push tokens for Live Activities but I am getting the same token twice, Why is that?
Is there any other way to get the token just once, so I can hit the API to save the token.
Here's the code:
Task {
for await data in runningActivity.pushTokenUpdates {
let myToken = data.hexString
self.count += 1
print("Count \(self.count)\n" + myToken)
}
Console:
Count 1 80dc21086f81.........646d7084805dc
Count 2 80dc21086f81.........646d7084805dc
I can't seem to understand why this is happening, and some times it takes significantly longer to get the tokens. Am I doing anything wrong? Please do share your thoughts.
Thank you!