SleepClassifyEvent Stay organized with collections Save and categorize content based on your preferences.
Page Summary
A SleepClassifyEvent represents a sleep classification event including timestamp, confidence, device motion, and ambient light level, reported at regular intervals.
You can extract a list of SleepClassifyEvent objects from an Intent using the
extractEventsmethod.You can check if an Intent contains any SleepClassifyEvent objects using the
hasEventsmethod.Methods like
getConfidence,getLight,getMotion, andgetTimestampMillisprovide specific details about the sleep classification event.
Represents a sleep classification event including the classification timestamp, the sleep confidence, and the supporting data such as device motion and ambient light level. Classification events are reported at a regular intervals, such as every 10 minutes.
Inherited Constant Summary
| int | CONTENTS_FILE_DESCRIPTOR | |
| int | PARCELABLE_WRITE_RETURN_VALUE |
Field Summary
| public static finalCreator<SleepClassifyEvent> | CREATOR |
Public Method Summary
| boolean | |
| staticList<SleepClassifyEvent> | |
| int | getConfidence() Returns a sleep confidence value between 0 and 100. |
| int | getLight() Returns the brightness of the space around the device, based on the device's ambient light sensor readings. |
| int | getMotion() Returns the amount of device motion, based on the device's accelerometer readings. |
| long | getTimestampMillis() Returns the UNIX epoch time when the event happened, expressed as the number of milliseconds since 1/1/1970 UTC. |
| static boolean | |
| int | hashCode() |
| String | toString() |
| void | writeToParcel(Parcel out, int flags) |
Inherited Method Summary
| abstract int | describeContents() |
| abstract void | writeToParcel(Parcel arg0, int arg1) |
Fields
public static finalCreator<SleepClassifyEvent>CREATOR
Public Methods
public booleanequals(Object o)
public staticList<SleepClassifyEvent>extractEvents(Intent intent)
Extracts theSleepClassifyEvent from anIntent.
Parameters
| intent | theIntent to extract from |
|---|
Returns
- a list of
SleepClassifyEvents if the intent has events, or an empty list if the intent doesn't contain any events.
public intgetConfidence()
Returns a sleep confidence value between 0 and 100. Higher values indicate that the user is more likely sleeping, while lower values indicate that the user is more likely awake.
public intgetLight()
Returns the brightness of the space around the device, based on the device's ambient light sensor readings. Value ranges from 1 to 6, inclusive. Higher values indicate brighter surroundings, while lower values indicate darker surroundings.
public intgetMotion()
Returns the amount of device motion, based on the device's accelerometer readings. Value ranges from 1 to 6, inclusive. Higher values indicate more movement of the device.
public longgetTimestampMillis()
Returns the UNIX epoch time when the event happened, expressed as the number of milliseconds since 1/1/1970 UTC.
public static booleanhasEvents(Intent intent)
Checks whether theIntent has anySleepClassifyEvent.
Parameters
| intent | theIntent to extract from |
|---|
Returns
- true if the Intent has events
public inthashCode()
publicStringtoString()
public voidwriteToParcel(Parcel out, int flags)
Except as otherwise noted, the content of this page is licensed under theCreative Commons Attribution 4.0 License, and code samples are licensed under theApache 2.0 License. For details, see theGoogle Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2024-10-31 UTC.