- Handle network interruptions gracefully using the offline mode.
- Understand the network buffer feature and its importance.
- Identify the common causes for offline mode.
What happens in offline mode
When the SDK enters offline mode, it handles everything in the background so the user is not interrupted. The SDK will:- Continue to record and store audio securely on the device.
- Save all session events that happen during the outage.
- Automatically upload all saved audio and events when the connection returns.
Network buffer feature
Before, the SDK used to directly jump into offline mode when it detected a small network issue. This was not ideal as it would interrupt the user experience. To address this, the mobile SDK uses a 15-second buffer to handle temporary connection problems. This gives you time to show a notification in your UI, like Connection unstable, before the session goes fully offline. This is important to ensure a smooth user experience.Common causes for offline mode
A session can enter offline mode for several reasons:- Poor or lost Wi-Fi or cellular connectivity.
- The device switches between networks (e.g., Wi-Fi to cellular).
- A temporary problem with the backend service.
- A dropped connection while streaming audio.
- An issue with an authentication token.
Create session failures without offline fallback
Not everycreateSession failure creates an offline session.
If the backend returns FAILED_PRECONDITION or INVALID_ARGUMENT as a SukiStatus (typically codes 9 and 3), the Mobile SDK returns the error and does not fall back to offline. Fix the request, then retry createSession online.
Other createSession failures can still follow the existing offline workflow. For more information, refer to Create ambient session and Ambient interoperability.
Offline sessions for the same encounter
The Mobile SDK groups offline work by encounter. If the device still has an unfinished offline session for an encounter, the nextcreateSession for that same encounter also starts offline. The new session joins the offline queue instead of trying to create online first.
For Form filling, that encounter key is the correlationId you pass on create (your appointment or encounter id). Use the same correlationId for every Form filling create that belongs to that visit. When the network returns, the SDK uploads queued sessions for that encounter oldest first.
For Form filling create options and offline details, refer to Create Form filling session and Set context and retrieve results.