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 |
class |
SleepSessionRecord.Stage
Captures the user's length and type of sleep. |
class |
SleepSessionRecord.StageType
Identifier for sleeping stage, as returned by |
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 | |
|---|---|
Fields
SLEEP_DURATION_TOTAL
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
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 |
getNotes
public CharSequence getNotes ()
Returns notes for the sleep session. Returns null if no notes was specified.
| Returns | |
|---|---|
CharSequence |
|
getStages
public List<SleepSessionRecord.Stage> getStages ()
Returns stages of the sleep session.
| Returns | |
|---|---|
List<SleepSessionRecord.Stage> |
This value cannot be null. |
getTitle
public CharSequence getTitle ()
Returns title of the sleep session. Returns null if no notes was specified.
| Returns | |
|---|---|
CharSequence |
|
hashCode
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 2025-08-20 UTC.