Data access

Samsung Health Data SDK provides various operation types, allowing developers to access Samsung Health data. Available operations may vary, depending on the data type. Operations like reading data, reading associated data and aggregating data return a list of data points, representing values stored in Samsung Health, such as a list of heart rate values from a specific time range.

Each data point includes a data ID and data source information representing the app and the device, which initially measured the data.

Read data

A reading operation is a basic query to get a set of data from Samsung Health. Users can set conditions such as data types, time range, or data source.

To read data, check the following property in each data type:

  • readDataRequestBuilder

Aggregate data

The aggregate operation is helpful to get summarized and processed data that is frequently used. It provides an aggregated value with a simple code. Conditions including a local time filter can be set to the aggregate operation.

To use the aggregate operation, check the properties of each data type from the list below:

  • TOTAL of StepType
  • TOTAL_ACTIVE_TIME in ActivitySummaryType
  • LAST of ActiveTimeGoalType
  • MIN and MAX in HeartRateType

Read changes

Reading changes gives data change information for a given data type and conditions. It returns a change list. Each change item includes a change type as UPSERT and DELETE and a change time. In case of updated data, a data point is retrieved. For deleted data, it gives the data’s ID. This feature helps keep the app current by reading only the changes made since the last synchronization with Samsung Health.

To read changed data, check the following property in each data type:

  • changedDataRequestBuilder

Read associated Data

Reading associated data is useful to get multiple data types which are related to each other. For example, Samsung Health records oxygen saturation and skin temperature during the user’s sleep. This operation helps to make a simple query to get sleep data (base data) with oxygen saturation and skin temperature data (associated data).

To read associated data, check the following property in each data type:

  • associatedReadRequestBuilder

Insert data

An insertion operation is a basic query to write sets of data into Samsung Health. You can specify the data type, corresponding values for each field and device used to record the data. Optionally, you may assign a unique identifier, referred to as the client data ID. For more details, please refer to HealthDataPoint.clientDataId in the SDK’s documentation.

To insert data, check the following property in each data type:

  • `insertDataRequestBuilder

Update data

Updating data is available for the data inserted into Samsung Health by the app. To update data, obtain the desired data’s uid or clientDataId and specify the data’s relevant fields, then update the data.

To update data, check the following property in each data type:

  • updateDataRequestBuilder

Delete data

Data deletion from Samsung Health is available using Samsung Health Data SDK. only data that was inserted by the app using the SDK can be deleted. To build a request for data deletion, one may set conditions like the data's ID or time filters.

To delete data, check the following property in each data type:

  • deleteDataRequestBuilder