SleepSegmentRequest

  • SleepSegmentRequest is a request object used to specify data to receive from the Sleep API, defaulting to requesting both sleep segment and classify events.

  • You can specify whether to request only sleep classify events, only sleep segment events, or both using the provided constants.

  • A default request for both types of sleep data can be created usinggetDefaultSleepSegmentRequest().

  • The requested data type can be retrieved using thegetRequestedDataType() method.

public classSleepSegmentRequest extendsObject
implementsParcelable

A request object that specifies what data to receive from the Sleep API. Defaults toSEGMENT_AND_CLASSIFY_EVENTS.

Constant Summary

int CLASSIFY_EVENTS_ONLYRequestsSleepClassifyEvent only.
int SEGMENT_AND_CLASSIFY_EVENTSRequests both theSleepSegmentEvent and theSleepClassifyEvent.
int SEGMENT_EVENTS_ONLYRequestsSleepSegmentEvent only.

Inherited Constant Summary

From interface android.os.Parcelable
intCONTENTS_FILE_DESCRIPTOR
intPARCELABLE_WRITE_RETURN_VALUE

Field Summary

public static finalCreator<SleepSegmentRequest> CREATOR

Public Constructor Summary

SleepSegmentRequest(int requestedDataType)
Constructs aSleepSegmentRequest indicating what type of data is being requested.

Public Method Summary

boolean
staticSleepSegmentRequest
getDefaultSleepSegmentRequest()
Creates a default request that registers for bothSleepSegmentEvent andSleepClassifyEvent data.
int
int
void
writeToParcel(Parcel parcel, 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)

Constants

public static final intCLASSIFY_EVENTS_ONLY

RequestsSleepClassifyEvent only.

Constant Value:2

public static final intSEGMENT_AND_CLASSIFY_EVENTS

Requests both theSleepSegmentEvent and theSleepClassifyEvent.

Constant Value:0

public static final intSEGMENT_EVENTS_ONLY

RequestsSleepSegmentEvent only.

Constant Value:1

Fields

public static finalCreator<SleepSegmentRequest>CREATOR

Public Constructors

publicSleepSegmentRequest(int requestedDataType)

Constructs aSleepSegmentRequest indicating what type of data is being requested.

Parameters
requestedDataTypeThe type of data to receive pending intents for; valid values are SEGMENT_AND_CLASSIFY_EVENTS, SEGMENT_EVENTS_ONLY, and CLASSIFY_EVENTS_ONLY.

Public Methods

public booleanequals(Object o)

public staticSleepSegmentRequestgetDefaultSleepSegmentRequest()

Creates a default request that registers for bothSleepSegmentEvent andSleepClassifyEvent data.

public intgetRequestedDataType()

Returns the requested data type, which is one of SEGMENT_AND_CLASSIFY_EVENTS, SEGMENT_EVENTS_ONLY, or CLASSIFY_EVENTS_ONLY.

public inthashCode()

public voidwriteToParcel(Parcel parcel, 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.