Device Metrics

b.well Health SDK for Android

Retrieving Device Metrics

Overview

The getDeviceMetrics method in the b.well SDK retrieves a flat, paginated list of raw Observation resources synced from a connected device or on-device health source.

Method Signature

suspend fun getDeviceMetrics(request: DeviceMetricsQueryRequest?): BWellResult<Observation>
  • request: Defines the search criteria for retrieving device metric observations.
  • BWellResult<Observation>: Represents the list of device metric observations retrieved.

Example Usage

val request = DeviceMetricsQueryRequest.Builder()
    .groupCode(listOf(Coding(code = code)))
    .build()

val result = BWellSdk.health.getDeviceMetrics(request)
if (result.success() && result is BWellResult.ResourceCollection) {
    val observations = result.data.orEmpty()
}

Best Practices

  • Appropriately set page and pageSize in the request to manage the volume of results (default page size is 20, maximum is 100).
  • Use getDeviceMetricsGroups instead if you want data pre-organized into named groups rather than a flat observation list.

Did this page help you?