public final class MediaSessionStatus extends Object
This class is part of the remote playback protocol described by the
MediaControlIntent
class.
When a media session is created, it is initially in the
active
state. When the media session ends
normally, it transitions to the ended
state.
If the media session is invalidated due to another session forcibly taking
control of the route, then it transitions to the
invalidated
state.
Refer to the documentation of each state for an explanation of its meaning.
To monitor session status, the application should supply a PendingIntent
to use as the
session status update receiver
for a given session start request
.
This object is immutable once created using a MediaSessionStatus.Builder
instance.
Modifier and Type | Class and Description |
---|---|
static class |
MediaSessionStatus.Builder
Builder for
media session status objects . |
Modifier and Type | Field and Description |
---|---|
static int |
SESSION_STATE_ACTIVE
Session state: Active.
|
static int |
SESSION_STATE_ENDED
Session state: Ended.
|
static int |
SESSION_STATE_INVALIDATED
Session state: Invalidated.
|
Modifier and Type | Method and Description |
---|---|
Bundle |
asBundle()
Converts this object to a bundle for serialization.
|
static MediaSessionStatus |
fromBundle(Bundle bundle)
Creates an instance from a bundle.
|
Bundle |
getExtras()
Gets a bundle of extras for this status object.
|
int |
getSessionState()
Gets the session state.
|
long |
getTimestamp()
Gets the timestamp associated with the status information in
milliseconds since boot in the
SystemClock.elapsedRealtime() time base. |
boolean |
isQueuePaused()
Returns true if the session's queue is paused.
|
String |
toString()
Returns a string representation of the object.
|
public static final int SESSION_STATE_ACTIVE
Indicates that the media session is active and in control of the route.
public static final int SESSION_STATE_ENDED
Indicates that the media session was ended normally using the
end session
action.
A terminated media session cannot be used anymore. To play more media, the application must start a new session.
public static final int SESSION_STATE_INVALIDATED
Indicates that the media session was invalidated involuntarily due to another session taking control of the route.
An invalidated media session cannot be used anymore. To play more media, the application must start a new session.
public long getTimestamp()
SystemClock.elapsedRealtime()
time base.SystemClock.elapsedRealtime()
time base.public int getSessionState()
SESSION_STATE_ACTIVE
,
SESSION_STATE_ENDED
, or SESSION_STATE_INVALIDATED
.public boolean isQueuePaused()
public Bundle getExtras()
public String toString()
Object
toString
method returns a string that
"textually represents" this object. The result should
be a concise but informative representation that is easy for a
person to read.
It is recommended that all subclasses override this method.
The toString
method for class Object
returns a string consisting of the name of the class of which the
object is an instance, the at-sign character `@
', and
the unsigned hexadecimal representation of the hash code of the
object. In other words, this method returns a string equal to the
value of:
getClass().getName() + '@' + Integer.toHexString(hashCode())
public Bundle asBundle()
public static MediaSessionStatus fromBundle(Bundle bundle)
bundle
- The bundle, or null if none.