RouteInfo

open class RouteInfo
kotlin.Any
   ↳ android.media.MediaRouter.RouteInfo

Information about a media route.
Requires API level 16 (Android 4.1, Jelly Bean)

Summary

Constants
static Int

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

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 receiver device type of the route indicating the type is unknown.

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 CharSequence!


Requires API level 16 (Android 4.1, Jelly Bean)

open Boolean

Returns true if the route is in the process of connecting and is not yet ready for use.

open MediaRouter.RouteGroup!


Requires API level 16 (Android 4.1, Jelly Bean)

open CharSequence!

Gets the user-visible name of the route.

open CharSequence!
getName(context: Context!)

Return the properly localized/resource user-visible name of this route.

open String

Returns a string representation of the object.

open Int


Requires API level 16 (Android 4.1, Jelly Bean)

open Int


Requires API level 16 (Android 4.1, Jelly Bean)

open Int


Requires API level 16 (Android 4.1, Jelly Bean)

open MediaRouter.RouteCategory!


Requires API level 16 (Android 4.1, Jelly Bean)

open Int

Return the current volume for this route.

open Boolean

Returns true if this route is enabled and may be selected.

open CharSequence!

Gets the user-visible description of the route.

open Unit
setTag(tag: Any!)

Set an application-specific tag object for this route.

open Any!


Requires API level 16 (Android 4.1, Jelly Bean)

open Unit

Request a volume change for this route.

open Unit

Request an incremental volume update for this route.

open Int

Gets the type of the receiver device associated with this route.

open Drawable!

Get the icon representing this route.

open 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.

open Int


Requires API level 16 (Android 4.1, Jelly Bean)

open Int


Requires API level 16 (Android 4.1, Jelly Bean)

Constants

DEVICE_TYPE_BLUETOOTH

added in API level 24
static val DEVICE_TYPE_BLUETOOTH: Int

A receiver device type of the route indicating the presentation of the media is happening on a bluetooth device such as a bluetooth speaker.
Requires API level 24 (Android 7.0, Nougat)

Value: 3

See Also

DEVICE_TYPE_SPEAKER

added in API level 24
static val DEVICE_TYPE_SPEAKER: Int

A receiver device type of the route indicating the presentation of the media is happening on a speaker.
Requires API level 24 (Android 7.0, Nougat)

Value: 2

See Also

DEVICE_TYPE_TV

added in API level 24
static val DEVICE_TYPE_TV: Int

A receiver device type of the route indicating the presentation of the media is happening on a TV.
Requires API level 24 (Android 7.0, Nougat)

Value: 1

See Also

DEVICE_TYPE_UNKNOWN

added in API level 24
static val DEVICE_TYPE_UNKNOWN: Int

The default receiver device type of the route indicating the type is unknown.
Requires API level 24 (Android 7.0, Nougat)

Value: 0

See Also

PLAYBACK_TYPE_LOCAL

added in API level 16
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.
Requires API level 16 (Android 4.1, Jelly Bean)

Value: 0

PLAYBACK_TYPE_REMOTE

added in API level 16
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.
Requires API level 16 (Android 4.1, Jelly Bean)

Value: 1

PLAYBACK_VOLUME_FIXED

added in API level 16
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.
Requires API level 16 (Android 4.1, Jelly Bean)

Value: 0

PLAYBACK_VOLUME_VARIABLE

added in API level 16
static val PLAYBACK_VOLUME_VARIABLE: Int

Playback information indicating the playback volume is variable and can be controlled from this object.
Requires API level 16 (Android 4.1, Jelly Bean)

Value: 1

Public methods

getStatus

added in API level 16
open fun getStatus(): CharSequence!


Requires API level 16 (Android 4.1, Jelly Bean)

Return
CharSequence!: The user-visible status for a media route. This may include a description of the currently playing media, if available.

isConnecting

added in API level 18
open fun isConnecting(): Boolean

Returns true if the route is in the process of connecting and is not yet ready for use.
Requires API level 18 (Android 4.3, Jelly Bean)

Return
Boolean: True if this route is in the process of connecting.

getGroup

added in API level 16
open fun getGroup(): MediaRouter.RouteGroup!


Requires API level 16 (Android 4.1, Jelly Bean)

Return
MediaRouter.RouteGroup!: The group that this route belongs to.

getName

added in API level 16
open fun getName(): CharSequence!

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.


Requires API level 16 (Android 4.1, Jelly Bean)
Return
CharSequence!: The user-visible name of a media route. This is the string presented to users who may select this as the active route.

getName

added in API level 16
open fun getName(context: Context!): CharSequence!

Return the properly localized/resource user-visible name of this route.

The route name identifies the destination represented by the route. It may be a user-supplied name, an alias, or device serial number.


Requires API level 16 (Android 4.1, Jelly Bean)
Parameters
context Context!: Context used to resolve the correct configuration to load
Return
CharSequence!: The user-visible name of a media route. This is the string presented to users who may select this as the active route.

toString

added in API level 16
open fun toString(): String

Returns a string representation of the object. In general, the 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()) 
Requires API level 16 (Android 4.1, Jelly Bean)
Return
String: a string representation of the object.

getSupportedTypes

added in API level 16
open fun getSupportedTypes(): Int


Requires API level 16 (Android 4.1, Jelly Bean)

Return
Int: A media type flag set describing which types this route supports.

getPlaybackType

added in API level 16
open fun getPlaybackType(): Int


Requires API level 16 (Android 4.1, Jelly Bean)

Return
Int: the type of playback associated with this route Value is android.media.MediaRouter.RouteInfo#PLAYBACK_TYPE_LOCAL, or android.media.MediaRouter.RouteInfo#PLAYBACK_TYPE_REMOTE

getVolumeHandling

added in API level 16
open fun getVolumeHandling(): Int


Requires API level 16 (Android 4.1, Jelly Bean)

Return
Int: how volume is handling on the route Value is android.media.MediaRouter.RouteInfo#PLAYBACK_VOLUME_FIXED, or android.media.MediaRouter.RouteInfo#PLAYBACK_VOLUME_VARIABLE

getCategory

added in API level 16
open fun getCategory(): MediaRouter.RouteCategory!


Requires API level 16 (Android 4.1, Jelly Bean)

Return
MediaRouter.RouteCategory!: the category this route belongs to.

getVolume

added in API level 16
open fun getVolume(): Int

Return the current volume for this route. Depending on the route, this may only be valid if the route is currently selected.
Requires API level 16 (Android 4.1, Jelly Bean)

Return
Int: the volume at which the playback associated with this route is performed

isEnabled

added in API level 17
open fun isEnabled(): Boolean

Returns true if this route is enabled and may be selected.
Requires API level 17 (Android 4.2, Jelly Bean)

Return
Boolean: True if this route is enabled.

getDescription

added in API level 18
open fun getDescription(): CharSequence!

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.


Requires API level 18 (Android 4.3, Jelly Bean)
Return
CharSequence!: The description of the route, or null if none.

setTag

added in API level 16
open fun setTag(tag: Any!): Unit

Set an application-specific tag object for this route. The application may use this to store arbitrary data associated with the route for internal tracking.

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.


Requires API level 16 (Android 4.1, Jelly Bean)
Parameters
tag Any!: Arbitrary, app-specific data for this route to hold for later use

getTag

added in API level 16
open fun getTag(): Any!


Requires API level 16 (Android 4.1, Jelly Bean)

Return
Any!: The tag object previously set by the application

See Also

requestSetVolume

added in API level 16
open fun requestSetVolume(volume: Int): Unit

Request a volume change for this route.
Requires API level 16 (Android 4.1, Jelly Bean)

Parameters
volume Int: value between 0 and getVolumeMax

requestUpdateVolume

added in API level 16
open fun requestUpdateVolume(direction: Int): Unit

Request an incremental volume update for this route.
Requires API level 16 (Android 4.1, Jelly Bean)

Parameters
direction Int: Delta to apply to the current volume

getDeviceType

added in API level 24
open fun getDeviceType(): Int

Gets the type of the receiver device associated with this route.
Requires API level 24 (Android 7.0, Nougat)

Return
Int: The type of the receiver device associated with this route: #DEVICE_TYPE_BLUETOOTH, #DEVICE_TYPE_TV, #DEVICE_TYPE_SPEAKER, or #DEVICE_TYPE_UNKNOWN. Value is android.media.MediaRouter.RouteInfo#DEVICE_TYPE_UNKNOWN, android.media.MediaRouter.RouteInfo#DEVICE_TYPE_TV, android.media.MediaRouter.RouteInfo#DEVICE_TYPE_SPEAKER, or android.media.MediaRouter.RouteInfo#DEVICE_TYPE_BLUETOOTH

getIconDrawable

added in API level 16
open fun getIconDrawable(): Drawable!

Get the icon representing this route. This icon will be used in picker UIs if available.
Requires API level 16 (Android 4.1, Jelly Bean)

Return
Drawable!: the icon representing this route or null if no icon is available

getPresentationDisplay

added in API level 17
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.


Requires API level 17 (Android 4.2, Jelly Bean)
Return
Display!: The preferred presentation display to use when this route is selected or null if none.

getVolumeMax

added in API level 16
open fun getVolumeMax(): Int


Requires API level 16 (Android 4.1, Jelly Bean)

Return
Int: the maximum volume at which the playback associated with this route is performed

getPlaybackStream

added in API level 16
open fun getPlaybackStream(): Int


Requires API level 16 (Android 4.1, Jelly Bean)

Return
Int: the stream over which the playback associated with this route is performed