Setup Mobile Sync

b.well Health SDK for Android

Setting Up Mobile Sync

Overview

The setupMobileSync method in the b.well SDK provisions the backend credentials needed to sync data from an on-device health source (e.g. a phone or wearable's local health store) for a given connection. This is a low-level primitive — most integrators should use connect instead, which composes this call along with the rest of the on-device session setup automatically.

Method Signature

suspend fun setupMobileSync(connectionId: String): BWellResult<MobileSyncCredentials>
  • connectionId: The identifier of the connection to provision for mobile sync.
  • BWellResult<MobileSyncCredentials>: Contains the credentials required to start an on-device sync session.

Example Usage

val result = BWellSdk.device.setupMobileSync(connectionId)
if (result.success() && result is BWellResult.SingleResource) {
    val credentials = result.data
    // Use credentials to start an on-device sync session
}

Best Practices

  • Prefer connect for standard integrations; only call setupMobileSync directly when you need low-level access to the provisioning step.
  • Ensure connectionId is non-blank before calling — a blank value returns an error result.

Did this page help you?