PlannedExerciseSessionRecord


public final class PlannedExerciseSessionRecord implements Record


Captures a planned exercise session, also commonly referred to as a training plan.

Each record contains a start time, end time, an exercise type and a list of [PlannedExerciseBlock] which describe the details of the planned session. The start and end times may be in the future.

Requires androidx.health.connect.client.HealthConnectFeatures.FEATURE_PLANNED_EXERCISE.

Summary

Public constructors

PlannedExerciseSessionRecord(
    @NonNull LocalDate startDate,
    @NonNull Duration duration,
    @NonNull List<@NonNull PlannedExerciseBlock> blocks,
    int exerciseType,
    String title,
    String notes,
    @NonNull Metadata metadata
)

Constructor that accepts a local date plus a duration.

PlannedExerciseSessionRecord(
    @NonNull Instant startTime,
    ZoneOffset startZoneOffset,
    @NonNull Instant endTime,
    ZoneOffset endZoneOffset,
    @NonNull List<@NonNull PlannedExerciseBlock> blocks,
    int exerciseType,
    String title,
    String notes,
    @NonNull Metadata metadata
)

Constructor that accepts a physical time and zone offset.

Public methods

boolean
equals(Object other)
final @NonNull List<@NonNull PlannedExerciseBlock>
final String

The exercise session that completed this planned session.

@NonNull Instant

End time of the record.

ZoneOffset

User experienced zone offset at endTime, or null if unknown.

final int

Type of exercise (e.g. walking, swimming).

@NonNull Metadata

Set of common metadata associated with the written record.

final String

Additional notes for the session.

@NonNull Instant

Start time of the record.

ZoneOffset

User experienced zone offset at startTime, or null if unknown.

final String

Title of the session.

final boolean
int
@NonNull String

Public constructors

PlannedExerciseSessionRecord

Added in 1.1.0-alpha10
public PlannedExerciseSessionRecord(
    @NonNull LocalDate startDate,
    @NonNull Duration duration,
    @NonNull List<@NonNull PlannedExerciseBlock> blocks,
    int exerciseType,
    String title,
    String notes,
    @NonNull Metadata metadata
)

Constructor that accepts a local date plus a duration. The start time will be implicitly generated from a local time at noon in the system default timezone on the day specified by startDate. The end time will be generated by adding duration to the start time.

Parameters
@NonNull LocalDate startDate

The date on which the session should occur.

@NonNull Duration duration

The expected or estimated duration of the session.

@NonNull List<@NonNull PlannedExerciseBlock> blocks

The PlannedExerciseBlocks that contain details of this session.

int exerciseType

The exercise type of this session.

String title

The title of this session.

String notes

Notes for this session.

@NonNull Metadata metadata

Metadata for this session.

PlannedExerciseSessionRecord

Added in 1.1.0-alpha10
public PlannedExerciseSessionRecord(
    @NonNull Instant startTime,
    ZoneOffset startZoneOffset,
    @NonNull Instant endTime,
    ZoneOffset endZoneOffset,
    @NonNull List<@NonNull PlannedExerciseBlock> blocks,
    int exerciseType,
    String title,
    String notes,
    @NonNull Metadata metadata
)

Constructor that accepts a physical time and zone offset.

Parameters
@NonNull Instant startTime

The time at which the session should start.

ZoneOffset startZoneOffset

The zone offset at the start of this session. If null is provided, this will default to the current system timezone.

@NonNull Instant endTime

The time at which the session should end.

ZoneOffset endZoneOffset

The zone offset at the end of this session. If null is provided, this will default to the current system timezone.

@NonNull List<@NonNull PlannedExerciseBlock> blocks

The PlannedExerciseBlocks that contain details of this session.

int exerciseType

The exercise type of this session.

String title

The title of this session.

String notes

Notes for this session.

@NonNull Metadata metadata

Metadata for this session.

Public methods

equals

public boolean equals(Object other)

getBlocks

Added in 1.1.0-alpha10
public final @NonNull List<@NonNull PlannedExerciseBlockgetBlocks()

getCompletedExerciseSessionId

Added in 1.1.0-alpha10
public final String getCompletedExerciseSessionId()

The exercise session that completed this planned session.

getEndTime

Added in 1.1.0-alpha10
public @NonNull Instant getEndTime()

End time of the record.

getEndZoneOffset

Added in 1.1.0-alpha10
public ZoneOffset getEndZoneOffset()

User experienced zone offset at endTime, or null if unknown. Providing these will help history aggregations results stay consistent should user travel. Queries with user experienced time filters will assume system current zone offset if the information is absent.

getExerciseType

Added in 1.1.0-alpha10
public final int getExerciseType()

Type of exercise (e.g. walking, swimming). Required field.

getMetadata

Added in 1.1.0-alpha10
public @NonNull Metadata getMetadata()

Set of common metadata associated with the written record.

getNotes

Added in 1.1.0-alpha10
public final String getNotes()

Additional notes for the session. Optional field.

getStartTime

Added in 1.1.0-alpha10
public @NonNull Instant getStartTime()

Start time of the record.

getStartZoneOffset

Added in 1.1.0-alpha10
public ZoneOffset getStartZoneOffset()

User experienced zone offset at startTime, or null if unknown. Providing these will help history aggregations results stay consistent should user travel. Queries with user experienced time filters will assume system current zone offset if the information is absent.

getTitle

Added in 1.1.0-alpha10
public final String getTitle()

Title of the session. Optional field.

hasExplicitTime

Added in 1.1.0-alpha10
public final boolean hasExplicitTime()

hashCode

public int hashCode()

toString

public @NonNull String toString()