I want to add Live Activities to my e-commerce app to show the estimated delivery ETA when an order is out for delivery, with the Live Activity initiated from the server.
Issue 1: How can I consistently obtain a pushToStart token when a user logs in to my e-commerce app? Currently, I’m considering starting and ending a dummy Live Activity to retrieve the token. Is there a better way to trigger pushToStartTokenUpdates and send the token to my server?
Issue 2: How do I properly invalidate the pushToStart token when a user logs out, ensuring the next user doesn’t inherit the same token? Ideally, I don't want the user to wait until the token is automatically invalidated before logging out.
Hi,
For 1 - They are sent to your Live Activity's pushToStart handler. The system will wake your process in the background so you can send this token to your server. Essentially, you can't trigger these callbacks as they are sent to you by a process you cannot control.
For 2 - The tokens are devices based, not user based so this isn't possible.
Rico
WWDR - DTS - Software Engineer