SleepSessionRecord

public final class SleepSessionRecord
extends IntervalRecord

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


Captures the user's sleep length and its stages. Each record represents a time interval for a full sleep session.

All Stage time intervals should fall within the sleep session interval. Time intervals for stages don't need to be continuous but shouldn't overlap.

Summary

Nested classes

class SleepSessionRecord.Builder

Builder class for SleepSessionRecord 

class SleepSessionRecord.Stage

Captures the user's length and type of sleep. 

class SleepSessionRecord.StageType

Identifier for sleeping stage, as returned by Stage#getType()

Fields

public static final AggregationType<Long> SLEEP_DURATION_TOTAL

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

Public methods

boolean equals(Object o)

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

CharSequence getNotes()

Returns notes for the sleep session.

List<SleepSessionRecord.Stage> getStages()

Returns stages of the sleep session.

CharSequence getTitle()

Returns title of the sleep session.

int hashCode()

Returns a hash code value for the object.

Inherited methods

Fields

SLEEP_DURATION_TOTAL

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

Metric identifier to retrieve total sleep 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: the reference object with which to compare. This value may be null.

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

getNotes

Added in API level 34
public CharSequence getNotes ()

Returns notes for the sleep session. Returns null if no notes was specified.

Returns
CharSequence

getStages

Added in API level 34
public List<SleepSessionRecord.Stage> getStages ()

Returns stages of the sleep session.

Returns
List<SleepSessionRecord.Stage> This value cannot be null.

getTitle

Added in API level 34
public CharSequence getTitle ()

Returns title of the sleep session. Returns null if no notes was specified.

Returns
CharSequence

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.