Fix background sync: hold BLE connection alive + persistent flusher + honest upload count - #3
Merged
Merged
Conversation
… honest upload count iOS only ever synced on app-open: pauseForBackground disconnected the band, so iOS dropped the Bluetooth assertion and suspended the app in ~34s, and the restore central never armed. Now we KEEP the live connection in the background (iOS resumes us per BLE notification under bluetooth-central) so the drain + upload continue. - Add one connection-independent flusher (~15s) that uploads queued records and retries anything a prior tick failed to send (uploader retains rows on any non-200). Removes the per-record flushing that was tripping the backend rate limit. No cooldown. - Show the honest uploaded count: read `received` from the ingest response (the client was reading a non-existent `processed` field, so it always showed 0/N). - BleRestoreManager is recovery-only: event-driven re-arm via setOwnsBand, and the 50-min cooldown timer is gone (replaced by an idle-after-sync flag). - Remove the 15-min WorkManager periodic task (iOS + Android) and all its plumbing; Android keep-alive is the Edge Tracking foreground service, iOS is the kept-alive connection with CB state-restoration as recovery only. - Ensure the flusher + Android foreground service start on every session-establish path (init/login/reconnect/resume), not just openSession. - Cleanup: drop the workmanager dependency, the BGTask/processing/fetch Info.plist entries, and RECEIVE_BOOT_COMPLETED.
abdulsaheel
added a commit
that referenced
this pull request
Jun 13, 2026
Merge pull request #3 from OpenStrap/fix/background-sync-keepalive
abdulsaheel
added a commit
that referenced
this pull request
Jun 26, 2026
Fix background sync: hold BLE connection alive + persistent flusher + honest upload count
abdulsaheel
added a commit
that referenced
this pull request
Jun 26, 2026
Merge pull request #3 from OpenStrap/fix/background-sync-keepalive
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.
iOS only ever synced on app-open: pauseForBackground disconnected the band, so iOS dropped the Bluetooth assertion and suspended the app in ~34s, and the restore central never armed. Now we KEEP the live connection in the background (iOS resumes us per BLE notification under bluetooth-central) so the drain + upload continue.
receivedfrom the ingest response (the client was reading a non-existentprocessedfield, so it always showed 0/N).