Added in API level 30

MediaRoute2Info

class MediaRoute2Info : Parcelable
kotlin.Any
   ↳ android.media.MediaRoute2Info

Describes the properties of a route.

Summary

Nested classes

Builder for media route info.

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 String

Route feature: Live audio.

static String

Route feature: Live video.

static String

Route feature: Remote audio playback.

static String

Route feature: Remote playback.

static String

Route feature: Remote video playback.

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.

static Int

Indicates the route is a Bluetooth Low Energy (BLE) HEADSET.

static Int

Indicates the route is a bluetooth device, such as a bluetooth speaker or headphones.

static Int

Indicates the route is the speaker system (i.e. a mono speaker or stereo speakers) built into the device.

static Int

Indicates the route is the audio device associated with a dock.

static Int

Indicates the route is a group of devices.

static Int

Indicates the route is an HDMI connection.

static Int

Indicates the route is a hearing aid.

static Int

Indicates the route is a remote Audio/Video Receiver (AVR).

static Int

Indicates the route is a remote car.

static Int

Indicates the route is a remote computer.

static Int

Indicates the route is a remote gaming console.

static Int

Indicates the route is a remote smartphone.

static Int

Indicates the route is a remote smartwatch.

static Int

Indicates the route is a remote speaker.

static Int

Indicates the route is a remote tablet.

static Int

Indicates the route is a remote docked tablet.

static Int

Indicates the route is a remote TV.

static Int

Indicates the route's type is unknown or undefined.

static Int

Indicates the route is a USB audio device in accessory mode.

static Int

Indicates the route is a USB audio device.

static Int

Indicates the route is a USB audio headset.

static Int

Indicates the route is a pair of wired headphones.

static Int

Indicates the route is a headset, which is the combination of a headphones and a microphone.

Inherited constants
Public methods
Int

Boolean
equals(other: Any?)

String?

Gets the package name of the app using the route.

Int

Gets the connection state of the route.

MutableSet<String!>

Gets the deduplication IDs associated to the route.

CharSequence?

Gets the user-visible description of the route.

Bundle?

Gets an optional bundle with extra data.

MutableList<String!>

Gets the supported features of the route.

Uri?

Gets the URI of the icon representing this route.

String

Gets the id of the route.

CharSequence

Gets the user-visible name of the route.

Int

Returns the type of this route.

Int

Gets the current volume of the route.

Int

Gets information about how volume is handled on the route.

Int

Gets the maximum volume of the route.

Int

Boolean

Returns whether the route is a system route or not.

String

Unit
writeToParcel(dest: Parcel, flags: Int)

Flatten this object in to a Parcel.

Properties
static Parcelable.Creator<MediaRoute2Info!>

Constants

CONNECTION_STATE_CONNECTED

Added in API level 30
static val CONNECTION_STATE_CONNECTED: Int

A connection state indicating the route is connected.

Value: 2

CONNECTION_STATE_CONNECTING

Added in API level 30
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

CONNECTION_STATE_DISCONNECTED

Added in API level 30
static val CONNECTION_STATE_DISCONNECTED: Int

The default connection state indicating the route is disconnected.

Value: 0

FEATURE_LIVE_AUDIO

Added in API level 30
static val FEATURE_LIVE_AUDIO: String

Route feature: Live audio.

A route that supports live audio routing will allow the media audio stream to be sent to supported destinations. This can include internal speakers or audio jacks on the device itself, A2DP devices, and more.

When a live audio route is selected, audio routing is transparent to the application. All audio played on the media stream will be routed to the selected destination.

Refer to the class documentation for details about live audio routes.

Value: "android.media.route.feature.LIVE_AUDIO"

FEATURE_LIVE_VIDEO

Added in API level 30
static val FEATURE_LIVE_VIDEO: String

Route feature: Live video.

A route that supports live video routing will allow a mirrored version of the device's primary display or a customized Presentation to be sent to supported destinations.

When a live video route is selected, audio and video routing is transparent to the application. By default, audio and video is routed to the selected destination. For certain live video routes, the application may also use a Presentation to replace the mirrored view on the external display with different content.

Refer to the class documentation for details about live video routes.

Value: "android.media.route.feature.LIVE_VIDEO"

FEATURE_REMOTE_AUDIO_PLAYBACK

Added in API level 30
static val FEATURE_REMOTE_AUDIO_PLAYBACK: String

Route feature: Remote audio playback.

A route that supports remote audio playback routing will allow an application to send requests to play audio content remotely to supported destinations.

Value: "android.media.route.feature.REMOTE_AUDIO_PLAYBACK"

FEATURE_REMOTE_PLAYBACK

Added in API level 30
static val FEATURE_REMOTE_PLAYBACK: String

Route feature: Remote playback.

A route that supports remote playback routing will allow an application to send requests to play content remotely to supported destinations. A route may only support audio playback or video playback.

Remote playback routes destinations operate independently of the local device. When a remote playback route is selected, the application can control the content playing on the destination using MediaRouter2.RoutingController#getControlHints(). The application may also receive status updates from the route regarding remote playback.

Refer to the class documentation for details about remote playback routes.

Value: "android.media.route.feature.REMOTE_PLAYBACK"

FEATURE_REMOTE_VIDEO_PLAYBACK

Added in API level 30
static val FEATURE_REMOTE_VIDEO_PLAYBACK: String

Route feature: Remote video playback.

A route that supports remote video playback routing will allow an application to send requests to play video content remotely to supported destinations.

Value: "android.media.route.feature.REMOTE_VIDEO_PLAYBACK"

PLAYBACK_VOLUME_FIXED

Added in API level 30
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

PLAYBACK_VOLUME_VARIABLE

Added in API level 30
static val PLAYBACK_VOLUME_VARIABLE: Int

Playback information indicating the playback volume is variable and can be controlled from this object.

Value: 1

TYPE_BLE_HEADSET

Added in API level 34
static val TYPE_BLE_HEADSET: Int

Indicates the route is a Bluetooth Low Energy (BLE) HEADSET.

Value: 26

See Also

TYPE_BLUETOOTH_A2DP

Added in API level 34
static val TYPE_BLUETOOTH_A2DP: Int

Indicates the route is a bluetooth device, such as a bluetooth speaker or headphones.

Value: 8

See Also

TYPE_BUILTIN_SPEAKER

Added in API level 34
static val TYPE_BUILTIN_SPEAKER: Int

Indicates the route is the speaker system (i.e. a mono speaker or stereo speakers) built into the device.

Value: 2

See Also

TYPE_DOCK

Added in API level 34
static val TYPE_DOCK: Int

Indicates the route is the audio device associated with a dock.

Value: 13

See Also

TYPE_GROUP

Added in API level 34
static val TYPE_GROUP: Int

Indicates the route is a group of devices.

Value: 2000

See Also

TYPE_HDMI

Added in API level 34
static val TYPE_HDMI: Int

Indicates the route is an HDMI connection.

Value: 9

See Also

TYPE_HEARING_AID

Added in API level 34
static val TYPE_HEARING_AID: Int

Indicates the route is a hearing aid.

Value: 23

See Also

TYPE_REMOTE_AUDIO_VIDEO_RECEIVER

Added in API level 34
static val TYPE_REMOTE_AUDIO_VIDEO_RECEIVER: Int

Indicates the route is a remote Audio/Video Receiver (AVR).

A remote device uses a routing protocol managed by the application, as opposed to the routing being done by the system.

Value: 1003

See Also

TYPE_REMOTE_CAR

static val TYPE_REMOTE_CAR: Int

Indicates the route is a remote car.

A remote device uses a routing protocol managed by the application, as opposed to the routing being done by the system.

Value: 1008

See Also

TYPE_REMOTE_COMPUTER

static val TYPE_REMOTE_COMPUTER: Int

Indicates the route is a remote computer.

A remote device uses a routing protocol managed by the application, as opposed to the routing being done by the system.

Value: 1006

See Also

TYPE_REMOTE_GAME_CONSOLE

static val TYPE_REMOTE_GAME_CONSOLE: Int

Indicates the route is a remote gaming console.

A remote device uses a routing protocol managed by the application, as opposed to the routing being done by the system.

Value: 1007

See Also

TYPE_REMOTE_SMARTPHONE

static val TYPE_REMOTE_SMARTPHONE: Int

Indicates the route is a remote smartphone.

A remote device uses a routing protocol managed by the application, as opposed to the routing being done by the system.

Value: 1010

See Also

TYPE_REMOTE_SMARTWATCH

static val TYPE_REMOTE_SMARTWATCH: Int

Indicates the route is a remote smartwatch.

A remote device uses a routing protocol managed by the application, as opposed to the routing being done by the system.

Value: 1009

See Also

TYPE_REMOTE_SPEAKER

Added in API level 34
static val TYPE_REMOTE_SPEAKER: Int

Indicates the route is a remote speaker.

A remote device uses a routing protocol managed by the application, as opposed to the routing being done by the system.

Value: 1002

See Also

TYPE_REMOTE_TABLET

static val TYPE_REMOTE_TABLET: Int

Indicates the route is a remote tablet.

A remote device uses a routing protocol managed by the application, as opposed to the routing being done by the system.

Value: 1004

See Also

TYPE_REMOTE_TABLET_DOCKED

static val TYPE_REMOTE_TABLET_DOCKED: Int

Indicates the route is a remote docked tablet.

A remote device uses a routing protocol managed by the application, as opposed to the routing being done by the system.

Value: 1005

See Also

TYPE_REMOTE_TV

Added in API level 34
static val TYPE_REMOTE_TV: Int

Indicates the route is a remote TV.

A remote device uses a routing protocol managed by the application, as opposed to the routing being done by the system.

Value: 1001

See Also

TYPE_UNKNOWN

Added in API level 34
static val TYPE_UNKNOWN: Int

Indicates the route's type is unknown or undefined.

Value: 0

See Also

TYPE_USB_ACCESSORY

Added in API level 34
static val TYPE_USB_ACCESSORY: Int

Indicates the route is a USB audio device in accessory mode.

Value: 12

See Also

TYPE_USB_DEVICE

Added in API level 34
static val TYPE_USB_DEVICE: Int

Indicates the route is a USB audio device.

Value: 11

See Also

TYPE_USB_HEADSET

Added in API level 34
static val TYPE_USB_HEADSET: Int

Indicates the route is a USB audio headset.

Value: 22

See Also

TYPE_WIRED_HEADPHONES

Added in API level 34
static val TYPE_WIRED_HEADPHONES: Int

Indicates the route is a pair of wired headphones.

Value: 4

See Also

TYPE_WIRED_HEADSET

Added in API level 34
static val TYPE_WIRED_HEADSET: Int

Indicates the route is a headset, which is the combination of a headphones and a microphone.

Value: 3

See Also

Public methods

describeContents

Added in API level 30
fun describeContents(): Int
Return
Int a bitmask indicating the set of special object types marshaled by this Parcelable object instance. Value is either 0 or android.os.Parcelable#CONTENTS_FILE_DESCRIPTOR

equals

Added in API level 30
fun equals(other: Any?): Boolean
Parameters
obj the reference object with which to compare.
Return
Boolean true if this object is the same as the obj argument; false otherwise.

getClientPackageName

Added in API level 30
fun getClientPackageName(): String?

Gets the package name of the app using the route. Returns null if no apps are using this route.

getDeduplicationIds

Added in API level 34
fun getDeduplicationIds(): MutableSet<String!>

Gets the deduplication IDs associated to the route.

Two routes with a matching deduplication ID originate from the same receiver device.

Return
MutableSet<String!> This value cannot be null.

getDescription

Added in API level 30
fun getDescription(): CharSequence?

Gets the user-visible description of the route.

Return
CharSequence? This value may be null.

getExtras

Added in API level 30
fun getExtras(): Bundle?

Gets an optional bundle with extra data.

Return
Bundle? This value may be null.

getFeatures

Added in API level 30
fun getFeatures(): MutableList<String!>

Gets the supported features of the route.

Return
MutableList<String!> This value cannot be null.

getIconUri

Added in API level 30
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

Added in API level 30
fun getId(): String

Gets the id of the route. The routes which are given by MediaRouter2 will have unique IDs.

In order to ensure uniqueness in MediaRouter2 side, the value of this method can be different from what was set in MediaRoute2ProviderService.

Return
String This value cannot be null.

getName

Added in API level 30
fun getName(): CharSequence

Gets the user-visible name of the route.

Return
CharSequence This value cannot be null.

getVolume

Added in API level 30
fun getVolume(): Int

Gets the current volume of the route. This may be invalid if the route is not selected.

getVolumeHandling

Added in API level 30
fun getVolumeHandling(): Int

Gets information about how volume is handled on the route.

Return
Int PLAYBACK_VOLUME_FIXED or PLAYBACK_VOLUME_VARIABLE Value is android.media.MediaRoute2Info#PLAYBACK_VOLUME_FIXED, or android.media.MediaRoute2Info#PLAYBACK_VOLUME_VARIABLE

getVolumeMax

Added in API level 30
fun getVolumeMax(): Int

Gets the maximum volume of the route.

hashCode

Added in API level 30
fun hashCode(): Int
Return
Int a hash code value for this object.

isSystemRoute

Added in API level 30
fun isSystemRoute(): Boolean

Returns whether the route is a system route or not.

System routes are media routes directly controlled by the system such as phone speaker, wired headset, and Bluetooth devices.

toString

Added in API level 30
fun toString(): String
Return
String a string representation of the object.

writeToParcel

Added in API level 30
fun writeToParcel(
    dest: Parcel,
    flags: Int
): Unit

Flatten this object in to a Parcel.

Parameters
dest Parcel: This value cannot be null.
flags Int: Additional flags about how the object should be written. May be 0 or PARCELABLE_WRITE_RETURN_VALUE. Value is either 0 or a combination of android.os.Parcelable#PARCELABLE_WRITE_RETURN_VALUE, and android.os.Parcelable.PARCELABLE_ELIDE_DUPLICATES

Properties

CREATOR

Added in API level 30
static val CREATOR: Parcelable.Creator<MediaRoute2Info!>