RouteInfo
class RouteInfo
| kotlin.Any | |
| ↳ | androidx.mediarouter.media.MediaRouter.RouteInfo |
Provides information about a media route.
Each media route has a list of media control intent filters that describe the capabilities of the route and the manner in which it is used and controlled.
Summary
| Constants | |
|---|---|
| static Int |
A connection state indicating the route is connected. |
| static Int |
A connection state indicating the route is in the process of connecting and is not yet ready for use. |
| static Int |
The default connection state indicating the route is disconnected. |
| static Int |
A receiver device type of the route indicating the presentation of the media is happening on a speaker. |
| static Int |
A receiver device type of the route indicating the presentation of the media is happening on a TV. |
| static Int |
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 |
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 information indicating the playback volume is fixed, i. |
| static Int |
Playback information indicating the playback volume is variable and can be controlled from this object. |
| Public methods | |
|---|---|
| open Boolean |
Gets whether this route supports disconnecting without interrupting playback. |
| open Int |
Gets the connection state of the route. |
| open MutableList<IntentFilter!>! |
Gets a list of |
| open String? |
Gets the user-visible description of the route. |
| open Int |
Gets the type of the receiver device associated with this route. |
| open Bundle? |
Gets a collection of extra properties about this route that were supplied by its media route provider, or null if none. |
| open Uri! |
Gets the URI of the icon representing this route. |
| open String |
getId()Gets the unique id of the route. |
| open String! |
getName()Gets the user-visible name of the route. |
| open Int |
Gets the audio stream over which the playback associated with this route is performed. |
| open Int |
Gets the type of playback associated with this route. |
| open Display? |
Gets the |
| open MediaRouter.ProviderInfo! |
Gets information about the provider of this media route. |
| open IntentSender? |
Gets an intent sender for launching a settings activity for this route. |
| open Int |
Gets the current volume for this route. |
| open Int |
Gets information about how volume is handled on the route. |
| open Int |
Gets the maximum volume at which the playback associated with this route is performed. |
| open Boolean |
Returns true if this route is a bluetooth route. |
| open Boolean |
Returns true if the route is in the process of connecting and is not yet ready for use. |
| open Boolean |
Returns true if this route is the default route. |
| open Boolean |
Returns true if this route is the default route and the device speaker. |
| open Boolean |
Returns true if this route is enabled and may be selected. |
| open Boolean |
Returns true if this route is currently selected. |
| open Boolean |
matchesSelector(@NonNull selector: MediaRouteSelector)Returns true if the route supports at least one of the capabilities described by a media route selector. |
| open Unit |
requestSetVolume(volume: Int)Requests a volume change for this route asynchronously. |
| open Unit |
requestUpdateVolume(delta: Int)Requests an incremental volume update for this route asynchronously. |
| open Unit |
select()Selects this media route. |
| open Unit |
sendControlRequest(@NonNull intent: Intent, @Nullable callback: MediaRouter.ControlRequestCallback?)Sends a |
| open Boolean |
supportsControlAction(@NonNull category: String, @NonNull action: String)Returns true if the route supports the specified |
| open Boolean |
supportsControlCategory(@NonNull category: String)Returns true if the route supports the specified |
| open Boolean |
supportsControlRequest(@NonNull intent: Intent)Returns true if the route supports the specified |
| open String |
toString() |
Constants
CONNECTION_STATE_CONNECTED
static val CONNECTION_STATE_CONNECTED: Int
A connection state indicating the route is connected.
Value: 2
See Also
CONNECTION_STATE_CONNECTING
static val CONNECTION_STATE_CONNECTING: Int
A connection state indicating the route is in the process of connecting and is not yet ready for use.
Value: 1
See Also
CONNECTION_STATE_DISCONNECTED
static val CONNECTION_STATE_DISCONNECTED: Int
The default connection state indicating the route is disconnected.
Value: 0
See Also
DEVICE_TYPE_SPEAKER
static val DEVICE_TYPE_SPEAKER: Int
A receiver device type of the route indicating the presentation of the media is happening on a speaker.
Value: 2
See Also
DEVICE_TYPE_TV
static val DEVICE_TYPE_TV: Int
A receiver device type of the route indicating the presentation of the media is happening on a TV.
Value: 1
See Also
PLAYBACK_TYPE_LOCAL
static val PLAYBACK_TYPE_LOCAL: Int
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.
Value: 0
See Also
PLAYBACK_TYPE_REMOTE
static val PLAYBACK_TYPE_REMOTE: Int
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.
Value: 1
See Also
PLAYBACK_VOLUME_FIXED
static val PLAYBACK_VOLUME_FIXED: Int
Playback information indicating the playback volume is fixed, i.e. it cannot be controlled from this object. An example of fixed playback volume is a remote player, playing over HDMI where the user prefers to control the volume on the HDMI sink, rather than attenuate at the source.
Value: 0
See Also
PLAYBACK_VOLUME_VARIABLE
static val PLAYBACK_VOLUME_VARIABLE: Int
Playback information indicating the playback volume is variable and can be controlled from this object.
Value: 1
See Also
Public methods
canDisconnect
open fun canDisconnect(): Boolean
Gets whether this route supports disconnecting without interrupting playback.
| Return | |
|---|---|
Boolean |
True if this route can disconnect without stopping playback, false otherwise. |
getConnectionState
open fun getConnectionState(): Int
Gets the connection state of the route.
| Return | |
|---|---|
Int |
The connection state of this route: CONNECTION_STATE_DISCONNECTED, CONNECTION_STATE_CONNECTING, or CONNECTION_STATE_CONNECTED. |
getControlFilters
open fun getControlFilters(): MutableList<IntentFilter!>!
Gets a list of media control intent filters that describe the capabilities of this route and the media control actions that it supports.
| Return | |
|---|---|
MutableList<IntentFilter!>! |
A list of intent filters that specifies the media control intents that this route supports. |
getDescription
@Nullable open fun getDescription(): String?
Gets the user-visible description of the route.
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.
| Return | |
|---|---|
String? |
The description of the route, or null if none. |
getDeviceType
open fun getDeviceType(): Int
Gets the type of the receiver device associated with this route.
| Return | |
|---|---|
Int |
The type of the receiver device associated with this route: DEVICE_TYPE_TV or DEVICE_TYPE_SPEAKER. |
getExtras
@Nullable open fun getExtras(): Bundle?
Gets a collection of extra properties about this route that were supplied by its media route provider, or null if none.
getIconUri
open fun getIconUri(): Uri!
Gets the URI of the icon representing this route.
This icon will be used in picker UIs if available.
| Return | |
|---|---|
Uri! |
The URI of the icon representing this route, or null if none. |
getId
@NonNull open fun getId(): String
Gets the unique id of the route.
The route unique id functions as a stable identifier by which the route is known. For example, an application can use this id as a token to remember the selected route across restarts or to communicate its identity to a service.
| Return | |
|---|---|
String |
The unique id of the route, never null. |
getName
open fun getName(): String!
Gets the user-visible name of the route.
The route name identifies the destination represented by the route. It may be a user-supplied name, an alias, or device serial number.
| Return | |
|---|---|
String! |
The user-visible name of a media route. This is the string presented to users who may select this as the active route. |
getPlaybackStream
open fun getPlaybackStream(): Int
Gets the audio stream over which the playback associated with this route is performed.
| Return | |
|---|---|
Int |
The stream over which the playback associated with this route is performed. |
getPlaybackType
open fun getPlaybackType(): Int
Gets the type of playback associated with this route.
| Return | |
|---|---|
Int |
The type of playback associated with this route: PLAYBACK_TYPE_LOCAL or PLAYBACK_TYPE_REMOTE. |
getPresentationDisplay
@Nullable open fun getPresentationDisplay(): Display?
Gets the Display that should be used by the application to show a android.app.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 Callback#onRoutePresentationDisplayChanged callback and show or dismiss its android.app.Presentation accordingly when the display becomes available or is removed.
This method only makes sense for live video routes.
| Return | |
|---|---|
Display? |
The preferred presentation display to use when this route is selected or null if none. |
getProvider
open fun getProvider(): MediaRouter.ProviderInfo!
Gets information about the provider of this media route.
getSettingsIntent
@Nullable open fun getSettingsIntent(): IntentSender?
Gets an intent sender for launching a settings activity for this route.
getVolume
open fun getVolume(): Int
Gets the current volume for this route. Depending on the route, this may only be valid if the route is currently selected.
| Return | |
|---|---|
Int |
The volume at which the playback associated with this route is performed. |
getVolumeHandling
open fun getVolumeHandling(): Int
Gets information about how volume is handled on the route.
| Return | |
|---|---|
Int |
How volume is handled on the route: PLAYBACK_VOLUME_FIXED or PLAYBACK_VOLUME_VARIABLE. |
getVolumeMax
open fun getVolumeMax(): Int
Gets the maximum volume at which the playback associated with this route is performed.
| Return | |
|---|---|
Int |
The maximum volume at which the playback associated with this route is performed. |
isBluetooth
open fun isBluetooth(): Boolean
Returns true if this route is a bluetooth route.
| Return | |
|---|---|
Boolean |
True if this route is a bluetooth route. |
See Also
isConnecting
open funisConnecting(): Boolean
Deprecated: use getConnectionState instead.
Returns true if the route is in the process of connecting and is not yet ready for use.
| Return | |
|---|---|
Boolean |
True if this route is in the process of connecting. |
isDefault
open fun isDefault(): Boolean
Returns true if this route is the default route.
| Return | |
|---|---|
Boolean |
True if this route is the default route. |
See Also
isDeviceSpeaker
open fun isDeviceSpeaker(): Boolean
Returns true if this route is the default route and the device speaker.
| Return | |
|---|---|
Boolean |
True if this route is the default route and the device speaker. |
isEnabled
open fun isEnabled(): Boolean
Returns true if this route is enabled and may be selected.
| Return | |
|---|---|
Boolean |
True if this route is enabled. |
isSelected
open fun isSelected(): Boolean
Returns true if this route is currently selected.
| Return | |
|---|---|
Boolean |
True if this route is currently selected. |
See Also
matchesSelector
open fun matchesSelector(@NonNull selector: MediaRouteSelector): Boolean
Returns true if the route supports at least one of the capabilities described by a media route selector.
| Parameters | |
|---|---|
selector |
MediaRouteSelector: The selector that specifies the capabilities to check. |
| Return | |
|---|---|
Boolean |
True if the route supports at least one of the capabilities described in the media route selector. |
requestSetVolume
open fun requestSetVolume(volume: Int): Unit
Requests a volume change for this route asynchronously.
This function may only be called on a selected route. It will have no effect if the route is currently unselected.
| Parameters | |
|---|---|
volume |
Int: The new volume value between 0 and getVolumeMax. |
requestUpdateVolume
open fun requestUpdateVolume(delta: Int): Unit
Requests an incremental volume update for this route asynchronously.
This function may only be called on a selected route. It will have no effect if the route is currently unselected.
| Parameters | |
|---|---|
delta |
Int: The delta to add to the current volume. |
sendControlRequest
open fun sendControlRequest(
@NonNull intent: Intent,
@Nullable callback: MediaRouter.ControlRequestCallback?
): Unit
Sends a media control request to be performed asynchronously by the route's destination.
Media control requests are used to request the route to perform actions such as starting remote playback of a media item.
This function may only be called on a selected route. Control requests sent to unselected routes will fail.
| Parameters | |
|---|---|
intent |
Intent: A media control intent. |
callback |
MediaRouter.ControlRequestCallback?: A ControlRequestCallback to invoke with the result of the request, or null if no result is required. |
See Also
supportsControlAction
open fun supportsControlAction(
@NonNull category: String,
@NonNull action: String
): Boolean
Returns true if the route supports the specified media control category and action.
Media control actions describe specific requests that an application can ask a route to perform.
| Parameters | |
|---|---|
category |
String: A media control category such as MediaControlIntent#CATEGORY_LIVE_AUDIO, MediaControlIntent#CATEGORY_LIVE_VIDEO, MediaControlIntent#CATEGORY_REMOTE_PLAYBACK, or a provider-defined media control category. |
action |
String: A media control action such as MediaControlIntent#ACTION_PLAY. |
| Return | |
|---|---|
Boolean |
True if the route supports the specified intent action. |
See Also
supportsControlCategory
open fun supportsControlCategory(@NonNull category: String): Boolean
Returns true if the route supports the specified media control category.
Media control categories describe the capabilities of this route such as whether it supports live audio streaming or remote playback.
| Parameters | |
|---|---|
category |
String: A media control category such as MediaControlIntent#CATEGORY_LIVE_AUDIO, MediaControlIntent#CATEGORY_LIVE_VIDEO, MediaControlIntent#CATEGORY_REMOTE_PLAYBACK, or a provider-defined media control category. |
| Return | |
|---|---|
Boolean |
True if the route supports the specified intent category. |
See Also
supportsControlRequest
open fun supportsControlRequest(@NonNull intent: Intent): Boolean
Returns true if the route supports the specified media control request.
Media control requests are used to request the route to perform actions such as starting remote playback of a media item.
| Parameters | |
|---|---|
intent |
Intent: A media control intent. |
| Return | |
|---|---|
Boolean |
True if the route can handle the specified intent. |
See Also
toString
open fun toString(): String

