AssociatedReadRequest

Represents a request for reading associated data with a specific DataType. A result of AssociatedReadRequest is retrieved with a list of HealthDataPoints.

The request can include IdFilter. In this case, more data uids can be set.

For example, the Samsung Health app records skin temperature and blood oxygen during sleep. Retrieving such associated data with the latest sleep data is available through:

  • Reading the latest sleep data and getting the sleep data's uid.

  • Building an AssociatedReadRequest with the sleep data's uid and adding associated data types to it.

This is the sample code for reading sleep associated data:

suspend fun readSleepAssociatedData(sleepDataPoint: HealthDataPoint) {
     val healthDataStore = HealthDataService.getStore(context)
     val sleepId = sleepDataPoint.uid
     val idFilter = IdFilter.fromDataUid(sleepId)
     val associatedReadRequest = DataTypes.SLEEP.associatedReadRequestBuilder
         .addAssociatedDataType(DataType.SleepType.Associates.BLOOD_OXYGEN)
         .addAssociatedDataType(DataType.SleepType.Associates.SKIN_TEMPERATURE)
         .setIdFilter(idFilter)
         // set some other conditions
         .build()

     // make asynchronous call for result
     val result = healthDataStore.readAssociatedData(associatedReadRequest)
     // process data
}

Since

1.0.0

Types

Link copied to clipboard

An associate builder to create an AssociatedReadRequest instance.

Properties

Link copied to clipboard

The associated data types of this request.

Link copied to clipboard

The data type of this request.

Link copied to clipboard

The IdFilter of this request.

Link copied to clipboard
val limit: Int?

The limit of this request, which means the total size of results data.

Link copied to clipboard

The page size of this request, which means the size of the data in one results page.

Link copied to clipboard

The page token of this request.

Preferences Submitted

You have successfully updated your cookie preferences.