readChangesAsync

Reads a set of changes made in the Samsung Health data according to the specified request.

This method returns the changes made to a data point, consisting of the type of change, the time change was made, and the updated data point or the deleted data uid. If there are multiple changes in a data point, only the status of the last change is returned. For example, if data is first inserted and then deleted, the method only returns the DELETE change. The example code for getting the changes since a specific time is as follows:

val changeRequest = DataTypes.HEART_RATE.changedDataRequestBuilder
    .setChangeTimeFilter(localTimeFilter.of(lastSyncTime, now)
    .build()

val results = healthDataStore.readChangesAsync(changeRequest).get().dataList

results.forEach { change ->
    if(change.changeType == ChangeType.UPSERT) {
        val upsertDataPoint = change.upsertDataPoint
        // Handle the inserted or updated DataPoint
    } else if(change.changeType == ChangeType.DELETE) {
        val deletedDataUid = change.deleteDataUid
        // Handle the deleted data uid
    }
}

Return

The AsyncSingleFuture instance delivering the result Change set.

Since

1.0.0

Parameters

request

An ChangedDataRequest instance to specify change read conditions.

Preferences Submitted

You have successfully updated your cookie preferences.