AI-generated Key Takeaways
-
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 using
getDefaultSleepSegmentRequest(). -
The requested data type can be retrieved using the
getRequestedDataType()method.
A request object that specifies what data to receive from the Sleep API. Defaults to
SEGMENT_AND_CLASSIFY_EVENTS.
Constant Summary
| int | CLASSIFY_EVENTS_ONLY | Requests SleepClassifyEvent
only. |
| int | SEGMENT_AND_CLASSIFY_EVENTS | Requests both the SleepSegmentEvent
and the SleepClassifyEvent. |
| int | SEGMENT_EVENTS_ONLY | Requests SleepSegmentEvent
only. |
Inherited Constant Summary
Field Summary
| public static final Creator<SleepSegmentRequest> | CREATOR |
Public Constructor Summary
|
SleepSegmentRequest(int requestedDataType)
Constructs a
SleepSegmentRequest
indicating what type of data is being requested.
|
Public Method Summary
| boolean | |
| static SleepSegmentRequest |
getDefaultSleepSegmentRequest()
Creates a default request that registers for both
SleepSegmentEvent and SleepClassifyEvent data.
|
| int |
getRequestedDataType()
Returns the requested data type, which is one of
SEGMENT_AND_CLASSIFY_EVENTS,
SEGMENT_EVENTS_ONLY, or
CLASSIFY_EVENTS_ONLY.
|
| int |
hashCode()
|
| void |
writeToParcel(Parcel parcel, int
flags)
|
Inherited Method Summary
Constants
public static final int CLASSIFY_EVENTS_ONLY
Requests SleepClassifyEvent only.
public static final int SEGMENT_AND_CLASSIFY_EVENTS
Requests both the SleepSegmentEvent and the
SleepClassifyEvent.
public static final int SEGMENT_EVENTS_ONLY
Requests SleepSegmentEvent only.
Fields
public static final Creator<SleepSegmentRequest> CREATOR
Public Constructors
public SleepSegmentRequest (int requestedDataType)
Constructs a SleepSegmentRequest
indicating what type of data is being requested.
Parameters
| requestedDataType | The 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 boolean equals (Object o)
public static SleepSegmentRequest getDefaultSleepSegmentRequest ()
Creates a default request that registers for both SleepSegmentEvent and
SleepClassifyEvent data.
public int getRequestedDataType ()
Returns the requested data type, which is one of
SEGMENT_AND_CLASSIFY_EVENTS,
SEGMENT_EVENTS_ONLY, or
CLASSIFY_EVENTS_ONLY.