Skip to content

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

Merged
marionbarker merged 2 commits into
devfrom
feature/la-local-creation
Oct 17, 2026
Merged

marionbarker merged 2 commits 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.

@marionbarker marionbarker left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Trusting this code is appropriate.
The build works for iOS 27 and iOS 18 phones.
Both had LA running and LA continues to work after building with this branch.

@marionbarker
marionbarker merged commit b9d76a8 into dev Oct 17, 2026
1 check passed
@marionbarker
marionbarker deleted the feature/la-local-creation branch October 17, 2026 23:48
snickerdoodleparent pushed a commit to snickerdoodle-co/LoopFollow that referenced this pull request Nov 4, 2026
Treatment details from a chart pill (loopandlearn#781), CGM sensor states from Nightscout notes (loopandlearn#763), the full
predictive low window (loopandlearn#751), app exit reasons and memory use logged (loopandlearn#788), the guardrail alert on the carb
and meal edit screens (loopandlearn#786), Loop's automatic boluses as Auto Bolus (loopandlearn#787), Loop IOB and COB on failed
loops and the pump battery held (loopandlearn#784); loopandlearn#734 and loopandlearn#771 were in already.

Kept from this branch: the time first in the bolus, carb and SMB pills (now "Auto Bolus" for Loop), the
weekend profile's own band color and its Treatments entry (moved into Treatment.historyEntries), the
override's scheduled end, the alarm title override, and the Live Activity history. The carb double-tap
gives way to loopandlearn#781's linked pills, which open any treatment.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01LgnnHLJbhxmQaEjQNYR5VZ
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.

2 participants