Skip to content

Thin Live Activity glucose points so one-minute CGMs fit the size limit - #2559

Open
ps2 wants to merge 1 commit into
next-devfrom
live-activity-thin-glucose-samples
Open

ps2 wants to merge 1 commit into
next-devfrom
live-activity-thin-glucose-samples

Conversation

@ps2

@ps2 ps2 commented Oct 8, 2026

Copy link
Copy Markdown
Collaborator

Fixes the Live Activity staying on "Open the app to update the widget" with 0.0 glucose when using Libre sensors (#2456).

Cause

ActivityKit drops any update whose content state encodes to more than 4 KB, and doesn't report an error. Libre sensors report every minute, so the activity was sending the 100-sample cap plus the prediction line:

Case Encoded size (JSON)
G7: 24 points + 79 predicted, or 72 points ~3.0 KB
Libre: 100 points, no prediction ~3.95 KB, before the bottom row and preset text
Libre: 100 points + 79 predicted ~5.4 KB

Every update was dropped, so only the placeholder activity created on foreground was ever shown. This matches the next-dev report in #2456 that it started right after switching from G7 to Libre 3+.

Change

The Live Activity chart now gets at most one point per ~5 minutes (4.5 min spacing, keeping the latest). Thinned Libre data comes to ~3.0 KB, the same as a G7. The current value and delta still use every sample.

Testing

The Loop scheme builds. The sizes come from encoding equivalent structures with JSONEncoder. Not yet tried on a phone with a Libre sensor.

ActivityKit drops updates whose content state encodes to more than 4 KB,
without an error. Libre sensors report every minute, so the activity
carried the 100-sample cap plus the prediction line: about 5.4 KB in
JSON, against about 3 KB for a G7. Every update was dropped and the
activity stayed on the empty placeholder, showing 0.0 and "Open the app
to update the widget" (#2456).

Send the chart at most one point per ~5 minutes, keeping the latest.
The current value and delta still use every sample.
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