Get Device Providers

b.well Health SDK for Android

Retrieving Device Providers

Overview

The getDeviceProviders method in the b.well SDK retrieves the list of health data providers available for connection, along with each provider's connection status.

Method Signature

suspend fun getDeviceProviders(): BWellResult<DeviceProviderList>
  • BWellResult<DeviceProviderList>: Contains providers, a list of available DeviceProvider entries.

Data Class: DeviceProvider

  • slug: Unique identifier for the provider.
  • name: Human readable name of the provider.
  • type: Either "cloud" (OAuth-based) or "mobile" (on-device sync).
  • connected: Whether the current user already has an active connection to this provider.
  • logoUrl: URL to the provider's logo image, if available.

Example Usage

val result = BWellSdk.device.getDeviceProviders()
if (result.success() && result is BWellResult.SingleResource) {
    val providers = result.data?.providers.orEmpty()
    // Display the list of providers, using `slug` to initiate a connection
}

Best Practices

  • Use slug from a DeviceProvider entry as the connectionId/sourceId for subsequent connection calls.
  • Re-fetch this list periodically, as provider availability can change.

Did this page help you?