Data | StepDiary

StepDiary sample download
(Nov 3, 2020)

The SDK's Health Data provides a StepDiary sample application to read the daily step count.

Prerequisites

Prerequisites to run StepDiary are:

  • Prepare an Android device that supports Android 10 (API level 29) or above.
    (Samsung and non-Samsung devices are available both.)

  • Add the StepDiary app's dev access code developer mode.

    • Client ID: com.samsung.android.app.stepdiary
    • Access code: lm13wUJx
  • Import StepDiary with Android Studio (or Eclipse).

  • Run StepDiary on the device.

Overview

StepDiary demonstrates how to use Health Data's APIs for retrieving the daily step count with HealthConstants.StepCount and daily step count trend data types.

It shows how to handle the step's binning data every 10 minutes.

StepDiary's sources and resources are:

Source / Resource

Description

AndroidManifest.xml

Declaring required permissions with the <meta-data> element.

java/com/samsung/android/app/stepdiary

 

StepDiaryActivity.kt

StepDiary's main activity
  • Connecting to the health data store and handling exceptions through ConnectionListener.
  • Checking permission to read HealthConstants.StepCount and daily step count trend.
  • Requesting permission if required.
  • Creating an option menu for setting permission.
  • Showing daily step count.

StepCountReader.kt

  • Reading today's HealthConstants.StepCount asynchronously.
    Reading today's HealthConstants.StepDailyTrend. It checks the total step count and binning data every 10 minutes.