Mobile SDKs
Synchronize Apple Health, Health Connect, and Samsung Health data from your mobile app.
Sonar supports cloud device providers through the server-to-server API. Mobile SDKs provide a separate path for health data stored on a person’s phone. They do not replace the public API or permit a Sonar API key to be embedded in a client application.
SDKs
| Surface | Package | On-device source |
|---|---|---|
| iOS (Swift) | SonarSDK | Apple Health through HealthKit |
| Android (Kotlin) | co.sonarhealth:sonar-sdk | Health Connect and Samsung Health |
| React Native | @sonar/react-native-sdk | Bindings to the iOS and Android SDKs |
How Data Moves
Native health records travel directly from the SDK to Sonar. Your backend reads the normalized results through the API and returns the data your app needs. The arrows below follow the data through these two routes.
Mobile SDK architecture
Data flowThe SDK synchronizes every supported type the user authorizes, owns its local progress and retry behavior, and reports state back to the mobile app. See SDK Authentication, Supported Native Data, and SDK Synchronization for each part of the exchange.
What Each Part Owns
| Part | Responsibility |
|---|---|
| Mobile app | Configure the SDK, start authentication, connect providers, and present state and recovery guidance |
| Customer backend | Resolve the signed-in customer to a Sonar user, create client tokens, receive webhooks, read API data, and manage source priority |
| Sonar SDK | Request native permissions, read health records, store incremental progress, upload, retry, and refresh its session |
| Sonar | Validate application and user scope, preserve source attribution, apply source priority, normalize records, manage provider connections, and expose the results through the API |
Stable Boundaries
- Long-lived Sonar API keys stay on your backend.
- Each installed SDK maintains its own session and credentials.
- The operating system remains the authority for health-data permission state.
- Apps must handle partial permission grants and permission changes after onboarding.
- Native data must ultimately use the same Sonar user identity as server-side API reads.
Platform References
- Mobile SDK Quickstart Complete backend, mobile, synchronization, webhook, and API flow
- iOS (Swift) HealthKit capabilities, permissions, and background delivery
- SDK Authentication User-scoped client tokens, refresh, recovery, and revocation
- SDK Interface Configuration, provider methods, state observation, immediate sync, and safe resynchronization
- Supported Native Data Apple Health, Health Connect, and Samsung Health records mapped to API resources
- SDK Synchronization Recent data, historical backfill, batching, retries, and data availability
- Provider Lifecycle Connect, permission loss, disconnect, reconnection, and deletion
- Android (Kotlin) Two provider connections, permissions, distribution, and synchronization
- React Native Cross-platform bindings and native configuration boundaries
- Cloud Device Providers The server-to-server integration path for cloud providers
Sonar