Step 1: Open the app project

Open the given Android app project and find

The SDK library is samsung-health-data.jar in lib.

Step 2: Make a query to read step_daily_trend

The data type’s name and properties are:



The date of summarized step count data in milliseconds.
It indicates 00:00:00 UTC of the date exactly.
* Type: long


Kind of device sources.
* All sources: -2

In, set a filter for:

  • "day_type": today
  • "source_type": all sources ("-2")
    * [Practice 1] Set a filter to get steps from all devices.
    *    - Fill below "TODO 1" with the source type's integer value for all devices
    *    - (Hint) See the video tutorial and find "source_type" description.
   // Create a filter for today's steps from all source devices
   Filter filter = Filter.and(
           Filter.eq("day_time", dayTime),
           Filter.eq("source_type", /*TODO 1*/));

Create a ReadRequest instance:

  • Data type name: ""
  • Set a filter to the instance
    * [Practice 2] Build read request for today's all step.
    *    - Fill below "TODO 2" with the daily step count trend's data type name.
    *    - (Hint) See the video tutorial and find the data type name.
   HealthDataResolver.ReadRequest request = new ReadRequest.Builder()
               .setDataType("/*TODO 2*/")
               .setProperties(new String[] {"count", "binning_data"})

Step 3: Get today’s step count result

step_daily_trend has:

  • "count" property



Total number of daily steps.
* Type: int

A listener receives a query result. Check the result:

  • "count" of HealthData
try { -> {
        try {
            Iterator<HealthData> iter = result.iterator();
            if (iter.hasNext()) {
                HealthData data =;
                int totalCount = data.getInt("count");
                byte[] binning = data.getBlob("binning_data");

                consumer.accept(new StepCountSummary(totalCount, getBinningCounts(binning)));
        } finally {
} catch (Exception e) {
    Log.e(TAG, "Getting step count fails.", e);

The binning_data of step_daily_trend includes detailed step status every 10 minutes in a day.



A set of step count data for every 10 minutes with the JSON format.
It provides maximum 144 data, 6 in an hour * 24 hours.
The "count" property gives just a total step count.
You can use this info to track more detailed step activity.
* Optional
* Type: byte[]

The binning_data is ZIP compressed as the JSON format with the following keys.

JSON key







Run the app project and check the app dashboard on a phone.

  • Today’s total step
  • Graph’s step count in binning_data

You're done!

Congratulations! You have successfully achieved the goal of this Code Lab activity. Now, you can create a basic health dashboard app by yourself! But, if you're having trouble, you may check out the link below.

Basic Health Dashboard Complete Code377.27 KB