Skip to content

Create the Live Activity locally when the app is in the foreground - #734

Open
bjorkert wants to merge 1 commit into
devfrom
feature/la-local-creation
Open

Create the Live Activity locally when the app is in the foreground#734
bjorkert wants to merge 1 commit into
devfrom
feature/la-local-creation

Conversation

@bjorkert

Copy link
Copy Markdown
Member

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.

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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant