You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Bug: BLE stays connected but app stops receiving audio (needs heartbeat + offline fallback to SD) #6570
On Android, the Omi CV1 can remain BLE-connected and continue streaming live audio packets, but the app stops receiving them after the app is closed/killed/backgrounded. When the user opens the app again, capture resumes, but all audio in between is lost.
Observed via BLE Diagnostics:
App closed at ~6:29
No audio data received after that
Device still believes it is connected and streaming
Environment
Device: Omi CV1
Firmware: 3.0.17
Android: 16
App: 1.0.531 (812)
Why this happens
Firmware can only reliably observe BLE link state and CCC subscription state. Android can keep the BLE link alive while the app process is no longer consuming notifications.
Proposed fix
Add an app→device liveness mechanism so firmware can detect when the phone/app is not actively receiving audio and fall back to offline storage.
Option A (recommended): Heartbeat/ACK characteristic
Add a small GATT characteristic for APP_HEARTBEAT.
App sends a heartbeat every N seconds while capture should be active.
Firmware starts writing to SD/LittleFS if heartbeat missing for >T seconds (and optionally stops streaming to save power).
Option B: CCC unsubscribe detection
If audio notify CCC is disabled, switch to SD recording.
(This may not catch the "app dead but CCC still enabled" case, so heartbeat is still preferred.)
Expected behavior
If app is closed/killed or stops consuming audio, device should automatically start recording to SD/LittleFS to prevent data loss.
When app returns and liveness resumes, device can switch back to streaming (or continue dual-mode if desired).
Notes
This is separate from WebSocket reconnect buffering issues; this is BLE notification consumption/liveness in the mobile app lifecycle.
Root Cause & Dual-Layer Fix Architecture for #6570
Investigated the audio packet loss during Android backgrounding/app-kill in omi/firmware/omi/src/lib/core/transport.c:
Root Cause in pusher() (lines 1224–1252):
Offline storage is guarded strictly by else if (!conn). When Android backgrounds or kills the app while keeping the BLE ACL link open (conn != NULL), any unsubscribed state (!is_subscribed) falls into the trailing else { bt_conn_unref(conn); k_sleep(K_MSEC(10)); } branch, silently dropping all queued audio packets instead of routing them to write_to_storage(). Furthermore, if CCC remains subscribed but GATT notification fails, pusher() ignores the return value of push_to_gatt(conn) and discards the frame.
Proposed Resolution:
Immediate Firmware Safety Net: Fall back to write_to_storage() whenever !conn || !is_subscribed || !push_success so connected-but-unsubscribed frames are never discarded.
Active Liveness (Option A): Introduce an APP_HEARTBEAT characteristic on the Settings service (19B10016-E8F2-537E-4F6C-D104768A1214, write-without-response) with a 15-second timeout. If the Android process is killed by OS power management without closing the link, the pendant detects missed heartbeats and diverts audio to SD storage.
App Side: A 5-second periodic heartbeat write in the mobile capture service while actively consuming audio notifications.
We have the C and Dart patches drafted. Since physical hardware flashing is required for final BLE link timing verification, would maintainers (@TuEmb, @Git-on-my-level) prefer a PR with this dual-layer implementation for device testing?
Activity
fix(ios): stop background audio keep-alive and back off BLE timeouts (#…
TheRWX commentedon Sep 23, 2026
Root Cause & Dual-Layer Fix Architecture for #6570
Investigated the audio packet loss during Android backgrounding/app-kill in
omi/firmware/omi/src/lib/core/transport.c:Root Cause in
pusher()(lines 1224–1252):Offline storage is guarded strictly by
else if (!conn). When Android backgrounds or kills the app while keeping the BLE ACL link open (conn != NULL), any unsubscribed state (!is_subscribed) falls into the trailingelse { bt_conn_unref(conn); k_sleep(K_MSEC(10)); }branch, silently dropping all queued audio packets instead of routing them towrite_to_storage(). Furthermore, if CCC remains subscribed but GATT notification fails,pusher()ignores the return value ofpush_to_gatt(conn)and discards the frame.Proposed Resolution:
write_to_storage()whenever!conn || !is_subscribed || !push_successso connected-but-unsubscribed frames are never discarded.APP_HEARTBEATcharacteristic on the Settings service (19B10016-E8F2-537E-4F6C-D104768A1214, write-without-response) with a 15-second timeout. If the Android process is killed by OS power management without closing the link, the pendant detects missed heartbeats and diverts audio to SD storage.We have the C and Dart patches drafted. Since physical hardware flashing is required for final BLE link timing verification, would maintainers (@TuEmb, @Git-on-my-level) prefer a PR with this dual-layer implementation for device testing?
PayPal: [email protected]