SleepClassifyEvent

  • 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 theextractEvents method.

  • You can check if an Intent contains any SleepClassifyEvent objects using thehasEvents method.

  • Methods likegetConfidence,getLight,getMotion, andgetTimestampMillis provide specific details about the sleep classification event.

public classSleepClassifyEvent extendsObject
implementsParcelable

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

From interface android.os.Parcelable
intCONTENTS_FILE_DESCRIPTOR
intPARCELABLE_WRITE_RETURN_VALUE

Field Summary

public static finalCreator<SleepClassifyEvent> CREATOR

Public Method Summary

boolean
staticList<SleepClassifyEvent>
extractEvents(Intent intent)
Extracts theSleepClassifyEvent from anIntent.
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
hasEvents(Intent intent)
Checks whether theIntent has anySleepClassifyEvent.
int
String
void
writeToParcel(Parcel out, int flags)

Inherited Method Summary

From class java.lang.Object
Object
clone()
boolean
equals(Object arg0)
void
finalize()
finalClass<?>
getClass()
int
hashCode()
final void
notify()
final void
notifyAll()
String
toString()
final void
wait(long arg0, int arg1)
final void
wait(long arg0)
final void
wait()
From interface android.os.Parcelable
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
intenttheIntent to extract from
Returns
  • a list ofSleepClassifyEvents 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
intenttheIntent 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.