SESSIONS

Exercise details with A list of ExerciseSessions.

  • Mandatory

The ExerciseType data comprises one or more ExerciseSessions within this property. Each ExerciseSession in the SESSIONS property logs details of a specific exercise activity such as running or cycling. For more information, see ExerciseSession.

The below sample code demonstrates how to read exercise data.

private suspend fun readExerciseData(store: HealthDataStore) {
     val readRequest = DataTypes.EXERCISE.readDataRequestBuilder
         // set filters
         .build()

     val dataPoints: List<HealthDataPoint> = store.readData(readRequest).dataList
     dataPoints.forEach { dataPoint ->
         val exerciseType = dataPoint.getValue(DataType.ExerciseType.EXERCISE_TYPE)
         val sessions = dataPoint.getValue(DataType.ExerciseType.SESSIONS)
         sessions?.forEach { session ->
             val exerciseSessionType = session.exerciseType
             val exerciseSessionDistance = session.distance
             // get other properties of session and do some processing
         }
     }
}

Since

1.0.0

Preferences Submitted

You have successfully updated your cookie preferences.