Create the Live Activity locally when the app is in the foreground - #734
Open
bjorkert wants to merge 1 commit into
Open
Create the Live Activity locally when the app is in the foreground#734bjorkert wants to merge 1 commit into
bjorkert wants to merge 1 commit into
Conversation
Every Live Activity creation went through an APNs push-to-start, which can show a banner or bump the Dynamic Island even when the app is open. Creation now uses Activity.request directly while the app is foreground active, and a healthy Live Activity is replaced the same way when the app is used with less than 4 hours left of its 8 hour lifetime, so the background push-to-start renewal is rarely needed. Push-to-start remains the creation path in the background and APNs setup is still required. Creation during app launch is deferred until the app is fully active, which fixes a race where a push-to-start fired during launch could briefly produce two activities.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Every Live Activity creation goes through an APNs push-to-start today, even when the app is open, and that push can show a banner or bump the Dynamic Island. With this change the app calls Activity.request directly when it is foreground active, both for new starts and as an opportunistic renewal: when the app is used with less than 4 hours left of the Live Activity's 8 hour lifetime, the activity is replaced locally so the background push-to-start renewal is rarely reached. For users who open the app now and then during the day this removes most of the push-to-start banners.
Push-to-start is still used when the app is in the background, and as fallback if a local create fails, so APNs setup remains a requirement for Live Activities. Updates are unchanged and still go over APNs. Creation during app launch is now deferred until the app is fully active, which also fixes a race where a push-to-start fired during launch could briefly produce two activities.