public abstract class SessionSample

  1. Object
  2. HealthSample
  3. SessionSample

Known subtypesSleepSample, WorkoutSample, NutritionSample

A bounded activity that groups child data – a workout, a night’s sleep, a logged meal.

Sessions are always intervals: HealthSample.isInstantaneous() is false for every subclass.

Constructors

protected SessionSample(HealthDataType type, long startMillis, long endMillis)Creates a session spanning [startMillis, endMillis].

Methods

public final String getTitle()A user-visible title, or null.
public final void setTitle(String title)Sets the user-visible title.
public final String getNotes()Free-form user notes, or null.
public final void setNotes(String notes)Sets free-form user notes.

Inherited methods

Constructor details

SessionSample

protected SessionSample(HealthDataType type, long startMillis, long endMillis)
Creates a session spanning [startMillis, endMillis].

Method details

getTitle

public final String getTitle()
A user-visible title, or null. Health Connect stores this natively; on iOS it is carried in sample metadata.

setTitle

public final void setTitle(String title)
Sets the user-visible title.

getNotes

public final String getNotes()
Free-form user notes, or null.

setNotes

public final void setNotes(String notes)
Sets free-form user notes.