I have implemented a live activity functionality into my app where a user can initiate multiple ones at the same time. Each time the user initiate a new live activity, I am storing the token in my server in order to use it for updating the live activity using a push notification.
I would like to come up with a way to notify the server once the user removes a live activity from the Lock Screen.
Potential Solution 1
Use background tasks. However, this way will work only if the user did not kill the app.
Potential Solution 2
Store the activity id somewhere and then once the user opens the app again I check if the stored activity id is contained within the Activity.activities array. If not, I notify the server that this activity id will no longer receive push notifications.
I would like to hear if any one has a better solution to my problem than the above potential solutions.