public static class MediaRouter.RouteInfo extends Object
Modifier and Type | Class and Description |
---|---|
static interface |
MediaRouter.RouteInfo.DeviceType |
static interface |
MediaRouter.RouteInfo.PlaybackType |
Modifier and Type | Field and Description |
---|---|
static int |
DEVICE_TYPE_BLUETOOTH
A receiver device type of the route indicating the presentation of the media is happening
on a bluetooth device such as a bluetooth speaker.
|
static int |
DEVICE_TYPE_SPEAKER
A receiver device type of the route indicating the presentation of the media is happening
on a speaker.
|
static int |
DEVICE_TYPE_TV
A receiver device type of the route indicating the presentation of the media is happening
on a TV.
|
static int |
DEVICE_TYPE_UNKNOWN
The default receiver device type of the route indicating the type is unknown.
|
static int |
PLAYBACK_TYPE_LOCAL
The default playback type, "local", indicating the presentation of the media is happening
on the same device (e.g. a phone, a tablet) as where it is controlled from.
|
static int |
PLAYBACK_TYPE_REMOTE
A playback type indicating the presentation of the media is happening on
a different device (i.e. the remote device) than where it is controlled from.
|
static int |
PLAYBACK_VOLUME_FIXED
Playback information indicating the playback volume is fixed, i.e. it cannot be
controlled from this object.
|
static int |
PLAYBACK_VOLUME_VARIABLE
Playback information indicating the playback volume is variable and can be controlled
from this object.
|
static int |
STATUS_AVAILABLE |
static int |
STATUS_CONNECTED |
static int |
STATUS_CONNECTING |
static int |
STATUS_IN_USE |
static int |
STATUS_NONE |
static int |
STATUS_NOT_AVAILABLE |
static int |
STATUS_SCANNING |
Modifier and Type | Method and Description |
---|---|
MediaRouter.RouteCategory |
getCategory() |
CharSequence |
getDescription()
Gets the user-visible description of the route.
|
String |
getDeviceAddress() |
int |
getDeviceType()
Gets the type of the receiver device associated with this route.
|
MediaRouter.RouteGroup |
getGroup() |
Drawable |
getIconDrawable()
Get the icon representing this route.
|
CharSequence |
getName()
Gets the user-visible name of the route.
|
CharSequence |
getName(Context context)
Return the properly localized/resource user-visible name of this route.
|
int |
getPlaybackStream() |
int |
getPlaybackType() |
Display |
getPresentationDisplay()
Gets the
Display that should be used by the application to show
a Presentation on an external display when this route is selected. |
CharSequence |
getStatus() |
int |
getStatusCode() |
int |
getSupportedTypes() |
Object |
getTag() |
int |
getVolume()
Return the current volume for this route.
|
int |
getVolumeHandling() |
int |
getVolumeMax() |
boolean |
isConnecting()
Returns true if the route is in the process of connecting and is not
yet ready for use.
|
boolean |
isDefault() |
boolean |
isEnabled()
Returns true if this route is enabled and may be selected.
|
boolean |
isSelected() |
boolean |
matchesTypes(int types) |
void |
requestSetVolume(int volume)
Request a volume change for this route.
|
void |
requestUpdateVolume(int direction)
Request an incremental volume update for this route.
|
void |
select() |
void |
setTag(Object tag)
Set an application-specific tag object for this route.
|
String |
toString()
Returns a string representation of the object.
|
public static final int STATUS_NONE
public static final int STATUS_SCANNING
public static final int STATUS_CONNECTING
public static final int STATUS_AVAILABLE
public static final int STATUS_NOT_AVAILABLE
public static final int STATUS_IN_USE
public static final int STATUS_CONNECTED
public static final int DEVICE_TYPE_UNKNOWN
getDeviceType()
,
Constant Field Valuespublic static final int DEVICE_TYPE_TV
getDeviceType()
,
Constant Field Valuespublic static final int DEVICE_TYPE_SPEAKER
getDeviceType()
,
Constant Field Valuespublic static final int DEVICE_TYPE_BLUETOOTH
getDeviceType()
,
Constant Field Valuespublic static final int PLAYBACK_TYPE_LOCAL
getPlaybackType()
,
Constant Field Valuespublic static final int PLAYBACK_TYPE_REMOTE
getPlaybackType()
,
Constant Field Valuespublic static final int PLAYBACK_VOLUME_FIXED
getVolumeHandling()
,
Constant Field Valuespublic static final int PLAYBACK_VOLUME_VARIABLE
getVolumeHandling()
,
Constant Field Valuespublic CharSequence 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 CharSequence getName(Context context)
The route name identifies the destination represented by the route. It may be a user-supplied name, an alias, or device serial number.
context
- Context used to resolve the correct configuration to loadpublic CharSequence 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 CharSequence getStatus()
public int getStatusCode()
public int getSupportedTypes()
public int getDeviceType()
DEVICE_TYPE_BLUETOOTH
, DEVICE_TYPE_TV
, DEVICE_TYPE_SPEAKER
,
or DEVICE_TYPE_UNKNOWN
.public boolean matchesTypes(int types)
public MediaRouter.RouteGroup getGroup()
public MediaRouter.RouteCategory getCategory()
public Drawable getIconDrawable()
public void setTag(Object tag)
Note that the lifespan of a route may be well past the lifespan of an Activity or other Context; take care that objects you store here will not keep more data in memory alive than you intend.
tag
- Arbitrary, app-specific data for this route to hold for later usepublic Object getTag()
setTag(Object)
public int getPlaybackType()
MediaRouter.UserRouteInfo.setPlaybackType(int)
public int getPlaybackStream()
MediaRouter.UserRouteInfo.setPlaybackStream(int)
public int getVolume()
MediaRouter.UserRouteInfo.setVolume(int)
public void requestSetVolume(int volume)
volume
- value between 0 and getVolumeMaxpublic void requestUpdateVolume(int direction)
direction
- Delta to apply to the current volumepublic int getVolumeMax()
MediaRouter.UserRouteInfo.setVolumeMax(int)
public int getVolumeHandling()
MediaRouter.UserRouteInfo.setVolumeHandling(int)
public Display getPresentationDisplay()
Display
that should be used by the application to show
a Presentation
on an external display when this route is selected.
Depending on the route, this may only be valid if the route is currently
selected.
The preferred presentation display may change independently of the route being selected or unselected. For example, the presentation display of the default system route may change when an external HDMI display is connected or disconnected even though the route itself has not changed.
This method may return null if there is no external display associated with the route or if the display is not ready to show UI yet.
The application should listen for changes to the presentation display
using the MediaRouter.Callback.onRoutePresentationDisplayChanged(android.media.MediaRouter, android.media.MediaRouter.RouteInfo)
callback and
show or dismiss its Presentation
accordingly when the display
becomes available or is removed.
This method only makes sense for live video
routes.
MediaRouter.ROUTE_TYPE_LIVE_VIDEO
,
Presentation
public String getDeviceAddress()
public boolean isEnabled()
public boolean isConnecting()
public boolean isSelected()
public boolean isDefault()
public void select()
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())