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.
classSleepSessionRecord.Builder
Builder class for SleepSessionRecord
classSleepSessionRecord.Stage
Captures the user's length and type of sleep.
classSleepSessionRecord.StageType
Identifier for sleeping stage, as returned by Stage.getType().
Inherited constants |
|---|
Fields | |
|---|---|
public
static
final
AggregationType<Long> |
SLEEP_DURATION_TOTAL
Metric identifier to retrieve total sleep session duration using aggregate APIs in |
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 | |
|---|---|
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 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 |
public CharSequence getNotes ()
Returns notes for the sleep session. Returns null if no notes was specified.
| Returns | |
|---|---|
CharSequence |
|
public List<SleepSessionRecord.Stage> getStages ()
Returns stages of the sleep session.
| Returns | |
|---|---|
List<SleepSessionRecord.Stage> |
This value cannot be null. |
public CharSequence getTitle ()
Returns title of the sleep session. Returns null if no notes was specified.
| Returns | |
|---|---|
CharSequence |
|
public int hashCode ()
Returns a hash code value for the object.
| Returns | |
|---|---|
int |
a hash code value for this object. |
Content and code samples on this page are subject to the licenses described in the Content License. Java and OpenJDK are trademarks or registered trademarks of Oracle and/or its affiliates.
Last updated 2026-07-01 UTC.