ExerciseSessionRecord


public final class ExerciseSessionRecord
extends IntervalRecord

java.lang.Object
   ↳ android.health.connect.datatypes.Record
     ↳ android.health.connect.datatypes.IntervalRecord
       ↳ android.health.connect.datatypes.ExerciseSessionRecord


Captures exercise or a sequence of exercises. This can be a playing game like football or a sequence of fitness exercises.

Each record needs a start time, end time and session type. In addition, each record has two optional independent lists of time intervals: ExerciseSegment represents particular exercise within session, ExerciseLap represents a lap time within session.

Summary

Nested classes

class ExerciseSessionRecord.Builder

Builder class for ExerciseSessionRecord 

Fields

public static final AggregationType<Long> EXERCISE_DURATION_TOTAL

Metric identifier to retrieve total exercise session duration using aggregate APIs in HealthConnectManager.

Public methods

boolean equals(Object o)

Indicates whether some other object is "equal to" this one.

int getExerciseType()

Returns exerciseType of this session.

List<ExerciseLap> getLaps()

Returns laps of this session.

CharSequence getNotes()

Returns notes for this activity.

String getPlannedExerciseSessionId()

Returns the ID of the PlannedExerciseSessionRecord that this session was based upon.

float getRateOfPerceivedExertion()

Gets the rate of perceived exertion (RPE) for this exercise session.

ExerciseRoute getRoute()

Returns route of this session.

List<ExerciseSegment> getSegments()

Returns segments of this session.

CharSequence getTitle()

Returns title of this session.

boolean hasRateOfPerceivedExertion()

Returns true if this session has an associated rate of perceived exertion.

boolean hasRoute()

Returns if this session has recorded route.

int hashCode()

Returns a hash code value for the object.

Inherited methods

Fields

EXERCISE_DURATION_TOTAL

Added in API level 34
public static final AggregationType<Long> EXERCISE_DURATION_TOTAL

Metric identifier to retrieve total exercise session duration using aggregate APIs in HealthConnectManager. Calculated in milliseconds.

Public methods

equals

Added in API level 34
public boolean equals (Object o)

Indicates whether some other object is "equal to" this one.

Parameters
o Object: This value may be null.

Returns
boolean true if this object is the same as the obj

getExerciseType

Added in API level 34
public int getExerciseType ()

Returns exerciseType of this session.

Returns
int Value is ExerciseSessionType.EXERCISE_SESSION_TYPE_UNKNOWN, ExerciseSessionType.EXERCISE_SESSION_TYPE_BADMINTON, ExerciseSessionType.EXERCISE_SESSION_TYPE_BASEBALL, ExerciseSessionType.EXERCISE_SESSION_TYPE_BASKETBALL, ExerciseSessionType.EXERCISE_SESSION_TYPE_BIKING, ExerciseSessionType.EXERCISE_SESSION_TYPE_BIKING_STATIONARY, ExerciseSessionType.EXERCISE_SESSION_TYPE_BOOT_CAMP, ExerciseSessionType.EXERCISE_SESSION_TYPE_BOXING, ExerciseSessionType.EXERCISE_SESSION_TYPE_CALISTHENICS, ExerciseSessionType.EXERCISE_SESSION_TYPE_CRICKET, ExerciseSessionType.EXERCISE_SESSION_TYPE_DANCING, ExerciseSessionType.EXERCISE_SESSION_TYPE_ELLIPTICAL, ExerciseSessionType.EXERCISE_SESSION_TYPE_EXERCISE_CLASS, ExerciseSessionType.EXERCISE_SESSION_TYPE_FENCING, ExerciseSessionType.EXERCISE_SESSION_TYPE_FOOTBALL_AMERICAN, ExerciseSessionType.EXERCISE_SESSION_TYPE_FOOTBALL_AUSTRALIAN, ExerciseSessionType.EXERCISE_SESSION_TYPE_FRISBEE_DISC, ExerciseSessionType.EXERCISE_SESSION_TYPE_GOLF, ExerciseSessionType.EXERCISE_SESSION_TYPE_GUIDED_BREATHING, ExerciseSessionType.EXERCISE_SESSION_TYPE_GYMNASTICS, ExerciseSessionType.EXERCISE_SESSION_TYPE_HANDBALL, ExerciseSessionType.EXERCISE_SESSION_TYPE_HIGH_INTENSITY_INTERVAL_TRAINING, ExerciseSessionType.EXERCISE_SESSION_TYPE_HIKING, ExerciseSessionType.EXERCISE_SESSION_TYPE_ICE_HOCKEY, ExerciseSessionType.EXERCISE_SESSION_TYPE_ICE_SKATING, ExerciseSessionType.EXERCISE_SESSION_TYPE_MARTIAL_ARTS, ExerciseSessionType.EXERCISE_SESSION_TYPE_PADDLING, ExerciseSessionType.EXERCISE_SESSION_TYPE_PARAGLIDING, ExerciseSessionType.EXERCISE_SESSION_TYPE_PILATES, ExerciseSessionType.EXERCISE_SESSION_TYPE_RACQUETBALL, ExerciseSessionType.EXERCISE_SESSION_TYPE_ROCK_CLIMBING, ExerciseSessionType.EXERCISE_SESSION_TYPE_ROLLER_HOCKEY, ExerciseSessionType.EXERCISE_SESSION_TYPE_ROWING, ExerciseSessionType.EXERCISE_SESSION_TYPE_ROWING_MACHINE, ExerciseSessionType.EXERCISE_SESSION_TYPE_RUGBY, ExerciseSessionType.EXERCISE_SESSION_TYPE_RUNNING, ExerciseSessionType.EXERCISE_SESSION_TYPE_RUNNING_TREADMILL, ExerciseSessionType.EXERCISE_SESSION_TYPE_SAILING, ExerciseSessionType.EXERCISE_SESSION_TYPE_SCUBA_DIVING, ExerciseSessionType.EXERCISE_SESSION_TYPE_SKATING, ExerciseSessionType.EXERCISE_SESSION_TYPE_SKIING, ExerciseSessionType.EXERCISE_SESSION_TYPE_SNOWBOARDING, ExerciseSessionType.EXERCISE_SESSION_TYPE_SNOWSHOEING, ExerciseSessionType.EXERCISE_SESSION_TYPE_SOCCER, ExerciseSessionType.EXERCISE_SESSION_TYPE_SOFTBALL, ExerciseSessionType.EXERCISE_SESSION_TYPE_SQUASH, ExerciseSessionType.EXERCISE_SESSION_TYPE_STAIR_CLIMBING, ExerciseSessionType.EXERCISE_SESSION_TYPE_STAIR_CLIMBING_MACHINE, ExerciseSessionType.EXERCISE_SESSION_TYPE_STRENGTH_TRAINING, ExerciseSessionType.EXERCISE_SESSION_TYPE_STRETCHING, ExerciseSessionType.EXERCISE_SESSION_TYPE_SURFING, ExerciseSessionType.EXERCISE_SESSION_TYPE_SWIMMING_OPEN_WATER, ExerciseSessionType.EXERCISE_SESSION_TYPE_SWIMMING_POOL, ExerciseSessionType.EXERCISE_SESSION_TYPE_TABLE_TENNIS, ExerciseSessionType.EXERCISE_SESSION_TYPE_TENNIS, ExerciseSessionType.EXERCISE_SESSION_TYPE_VOLLEYBALL, ExerciseSessionType.EXERCISE_SESSION_TYPE_WALKING, ExerciseSessionType.EXERCISE_SESSION_TYPE_WATER_POLO, ExerciseSessionType.EXERCISE_SESSION_TYPE_WEIGHTLIFTING, ExerciseSessionType.EXERCISE_SESSION_TYPE_WHEELCHAIR, ExerciseSessionType.EXERCISE_SESSION_TYPE_OTHER_WORKOUT, or ExerciseSessionType.EXERCISE_SESSION_TYPE_YOGA

getLaps

Added in API level 34
public List<ExerciseLap> getLaps ()

Returns laps of this session. Returns empty list if the session doesn't have exercise laps.

Returns
List<ExerciseLap> This value cannot be null.

getNotes

Added in API level 34
public CharSequence getNotes ()

Returns notes for this activity. Returns null if the session doesn't have notes.

Returns
CharSequence

getPlannedExerciseSessionId

Added in API level 35
Also in U Extensions 13
public String getPlannedExerciseSessionId ()

Returns the ID of the PlannedExerciseSessionRecord that this session was based upon. If not set, returns null.

Returns
String

getRateOfPerceivedExertion

public float getRateOfPerceivedExertion ()

Gets the rate of perceived exertion (RPE) for this exercise session.

Values correspond to the Borg CR10 RPE scale and must be in the range 0 to 10 inclusive. 0: No exertion (at rest) 1: Very light 2-3: Light 4-5: Moderate 6-7: Hard 8-9: Very hard 10: Maximum effort

Use hasRateOfPerceivedExertion() to check whether RPE exists for this session.

Returns
float Value is between 0.0f and 10.0f inclusive

Throws
IllegalStateException if rate of perceived exertion is not set.

getRoute

Added in API level 34
public ExerciseRoute getRoute ()

Returns route of this session. Returns null if the session doesn't have route.

Returns
ExerciseRoute

getSegments

Added in API level 34
public List<ExerciseSegment> getSegments ()

Returns segments of this session. Returns empty list if the session doesn't have exercise segments.

Returns
List<ExerciseSegment> This value cannot be null.

getTitle

Added in API level 34
public CharSequence getTitle ()

Returns title of this session. Returns null if the session doesn't have title.

Returns
CharSequence

hasRateOfPerceivedExertion

public boolean hasRateOfPerceivedExertion ()

Returns true if this session has an associated rate of perceived exertion.

Returns
boolean

hasRoute

Added in API level 34
public boolean hasRoute ()

Returns if this session has recorded route.

Returns
boolean This value cannot be null.

hashCode

Added in API level 34
public int hashCode ()

Returns a hash code value for the object.

Returns
int a hash code value for this object.