Daily Step Count Trend

The daily step count trend is Samsung Health's custom data type. It holds one month more data as differing with HealthConstants.StepCount.

It gives summarized step count data for a source type in a day.
See source_type description for more info.

If you need real-time step count data of the local device installed Samsung Health, use HealthConstants.StepCount.

Data Type Name

Its data type name is:


Data Permission

You need to acquire data permission for this data type to read data.
See Permission Manager and request data permission.

Use its data type name to add its permission to manifest.

     <meta-data android:name="com.samsung.android.health.permission.read"

Getting All Step Count

It's a common case that the user has a phone and an accessory like Galaxy Watch.
Sometimes the user can carry the phone and accessory both or only one device differently. If the user carried Galaxy Watch and Phone both as 1) and 4) sessions in the figure below, both devices created step count separately.

    • 1) 9:00 ~ 10:00 – carrying Galaxy Watch and Phone both.
    • 2) 10:00 ~ 10:40 – carrying only Phone.
    • 3) 10:40 ~ 12:00 – carrying only Galaxy Watch.
    • 4) 12:00 ~ 13:00 – carrying Galaxy Watch and Phone both.

Reading HealthConstants.StepCount data from 9:00 to 10:00 gives all measured steps from Galaxy Watch and Phone both. Adding all data’s step count in the result will be over than your expectation.
If you want to get the user's all steps for multiple data sources, duplicated steps have to be subtracted from the result. It is a tricky work definitely.

"com.samsung.shealth.step_daily_trend" is a simple way to get the user's all step count from multiple data sources.
Its source_type property defines the kind of data sources like all data sources, partner apps, and only the phone.

Most useful source type is -2 that provides the user's all step count for all data sources including devices and partner apps.

    // State of connection
    private HealthDataStore mStore;
    // Resolver instance
    private final HealthDataResolver mResolver;
    public static long getTodayStartUtcTime() {
        Calendar today = Calendar.getInstance(TimeZone.getTimeZone("UTC"));
        today.set(Calendar.HOUR_OF_DAY, 0);
        today.set(Calendar.MINUTE, 0);
        today.set(Calendar.SECOND, 0);
        today.set(Calendar.MILLISECOND, 0);
        return today.getTimeInMillis();
    public void readTodayStepCountData() {
        // Suppose that the required permission has been acquired already
        // Create a filter for today's steps from all source devices
        Filter filter = Filter.and(
            Filter.eq("day_time", getTodayStartUtcTime()),
            Filter.eq("source_type", -2));
        ReadRequest request = new ReadRequest.Builder()
            // Set the data type
            // Set a filter
            // Build
        mResolver = new HealthDataResolver(store, null); 
        try {
            mResolver.read(request).setResultListener(result -> {
                long dayTime = 0;
                int totalCount = 0;
                try {
                    Iterator iterator = result.iterator();
                    if (iterator.hasNext()) {
                        HealthData data = iterator.next();
                        dayTime = data.getLong("day_time")
                        totalCount = data.getInt("count");
                } finally {
        } catch (Exception e) {
            Log.e(MainActivity.APP_TAG, e.getClass().getName() + " - " + e.getMessage());

Copyright © Samsung Electronics, Co., Ltd. All rights reserved.