Pretty much the title. I am a noob in apple app development and currently starting it out. I got stuck in this. Can anyone let me know that how can i generate the token for starting live activity in terminated state? I have tried multiple times to find that this one is not working in terminated state. How can I overcome this? Is there any solution or workaround?
Generating token using pushToStartTokenUpdates in terminated state
It is not clear to me what exactly it is you are asking.
For starters, your app cannot do anything at all when it is in terminated state. No code is running.
So, you cannot generate anything, but on the other hand, you do not generate these tokens anyways, and you only await for the tokens after you create an activity, or you can await for an activity and then the subsequent token updates.
But all this requires your app to be running. When it is terminated, you have no code running, and can't do any of this.
Although, I suspect I may not have understood what you meant to ask, so if you can explain what you are trying to accomplish, perhaps I can help.
Hi, Thanks for the reply. I will give you some more context. The app I am working on currently receives temperature updates frequently even when the app is in terminated state. If the temperature is decreasing suddenly, I can send a push notification even in terminated state. Instead of push notification, I want to display the data in dynamic island. For that, I need the pushtostarttokenupdates to start the live activity via push notification. This is what I am trying to do.
I’m also facing the same issue — when the app is not in a running state for an extended period (e.g., 1–2 days), the pushToStartTokenUpdates
does not work, and the push token is not being sent to the server. As a result, subsequent update or end events are never triggered.
It seems that the token exchange mechanism is failing silently when the app remains terminated for a long time.
My questions are:
Alternatively, is it possible to schedule a Live Activity (e.g., trigger it periodically via notification) so that token exchange can be refreshed automatically?
Any guidance or recommended approach to handle such long-term terminated states would be appreciated.