public final class MediaRouteDescriptor extends Object
Each route is uniquely identified by an opaque id string. This token may take any form as long as it is unique within the media route provider.
This object is immutable once created using a MediaRouteDescriptor.Builder
instance.
Modifier and Type | Class and Description |
---|---|
static class |
MediaRouteDescriptor.Builder
Builder for
media route descriptors . |
Modifier and Type | Method and Description |
---|---|
Bundle |
asBundle()
Converts this object to a bundle for serialization.
|
boolean |
canDisconnectAndKeepPlaying()
Gets whether the route can be disconnected without stopping playback.
|
static MediaRouteDescriptor |
fromBundle(Bundle bundle)
Creates an instance from a bundle.
|
int |
getConnectionState()
Gets the connection state of the route.
|
List<IntentFilter> |
getControlFilters()
Gets the route's
media control intent filters. |
String |
getDescription()
Gets the user-visible description of the route.
|
int |
getDeviceType()
Gets the type of the receiver device associated with this route.
|
Bundle |
getExtras()
Gets a bundle of extras for this route descriptor.
|
List<String> |
getGroupMemberIds()
Gets the group member ids of the route.
|
Uri |
getIconUri()
Gets the URI of the icon representing this route.
|
String |
getId()
Gets the unique id of the route.
|
int |
getMaxClientVersion()
Gets the maximum client version required for this route.
|
int |
getMinClientVersion()
Gets the minimum client version required for this route.
|
String |
getName()
Gets the user-visible name of the route.
|
int |
getPlaybackStream()
Gets the route's playback stream.
|
int |
getPlaybackType()
Gets the type of playback associated with this route.
|
int |
getPresentationDisplayId()
Gets the route's presentation display id, or -1 if none.
|
IntentSender |
getSettingsActivity()
Gets an
IntentSender for starting a settings activity for this
route. |
int |
getVolume()
Gets the route's current volume, or 0 if unknown.
|
int |
getVolumeHandling()
Gets information about how volume is handled on the route.
|
int |
getVolumeMax()
Gets the route's maximum volume, or 0 if unknown.
|
boolean |
isConnecting()
Deprecated.
Use
getConnectionState() instead |
boolean |
isEnabled()
Gets whether the route is enabled.
|
boolean |
isValid()
Returns true if the route descriptor has all of the required fields.
|
String |
toString()
Returns a string representation of the object.
|
public String getId()
The route id associated with a route descriptor functions as a stable identifier for the route and must be unique among all routes offered by the provider.
public List<String> getGroupMemberIds()
A route descriptor that has one or more group member route ids represents a route group. A member route may belong to another group.
public String getName()
The route name identifies the destination represented by the route. It may be a user-supplied name, an alias, or device serial number.
public String getDescription()
The route description describes the kind of destination represented by the route. It may be a user-supplied string, a model number or brand of device.
public Uri getIconUri()
This icon will be used in picker UIs if available.
public boolean isEnabled()
@Deprecated public boolean isConnecting()
getConnectionState()
insteadpublic int getConnectionState()
MediaRouter.RouteInfo.CONNECTION_STATE_DISCONNECTED
,
MediaRouter.RouteInfo.CONNECTION_STATE_CONNECTING
, or
MediaRouter.RouteInfo.CONNECTION_STATE_CONNECTED
.public boolean canDisconnectAndKeepPlaying()
The route can normally be disconnected without stopping playback when the destination device on the route is connected to two or more source devices. The route provider should update the route immediately when the number of connected devices changes.
To specify that the route should disconnect without stopping use
MediaRouter.unselect(int)
with
MediaRouter.UNSELECT_REASON_DISCONNECTED
.
public IntentSender getSettingsActivity()
IntentSender
for starting a settings activity for this
route. The activity may have specific route settings or general settings
for the connected device or route provider.IntentSender
to start a settings activity.public List<IntentFilter> getControlFilters()
media control intent
filters.public int getPlaybackType()
MediaRouter.RouteInfo.PLAYBACK_TYPE_LOCAL
or
MediaRouter.RouteInfo.PLAYBACK_TYPE_REMOTE
.public int getPlaybackStream()
public int getDeviceType()
MediaRouter.RouteInfo.DEVICE_TYPE_TV
or
MediaRouter.RouteInfo.DEVICE_TYPE_SPEAKER
.public int getVolume()
public int getVolumeMax()
public int getVolumeHandling()
MediaRouter.RouteInfo.PLAYBACK_VOLUME_FIXED
or
MediaRouter.RouteInfo.PLAYBACK_VOLUME_VARIABLE
.public int getPresentationDisplayId()
public Bundle getExtras()
public int getMinClientVersion()
public int getMaxClientVersion()
public boolean isValid()
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 MediaRouteDescriptor fromBundle(Bundle bundle)
bundle
- The bundle, or null if none.