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 that the route is never suitable for media playback.

static Int

Indicates the route is always suitable for media playback.

static Int

Indicates that the route is suitable for media playback only after explicit user selection.

static Int

Indicates the route is using the auxiliary line-level connectors.

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 an Audio Return Channel of an HDMI connection.

static Int

Indicates the route is an Enhanced Audio Return Channel of an HDMI connection.

static Int

Indicates the route is a hearing aid.

static Int

Indicates the route is an analog line-level connection.

static Int

Indicates the route is a digital line connection (for example S/PDIF).

static Int

Indicates the route is a speaker group supporting multichannel contents.

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

Describe the kinds of special objects contained in this Parcelable instance's marshaled representation.

Boolean
equals(other: Any?)

Indicates whether some other object is "equal to" this one.

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 unique id of the route, if available.

CharSequence

Gets the user-visible name of the route.

MutableList<MutableSet<String!>!>

Int

Returns the route suitability status.

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

Returns a hash code value for the object.

Boolean

Returns whether the route is a system route or not.

String

Returns a string representation of the object.

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

SUITABILITY_STATUS_NOT_SUITABLE_FOR_TRANSFER

Added in API level 35
static val SUITABILITY_STATUS_NOT_SUITABLE_FOR_TRANSFER: Int

Indicates that the route is never suitable for media playback.

Value: 2

SUITABILITY_STATUS_SUITABLE_FOR_DEFAULT_TRANSFER

Added in API level 35
static val SUITABILITY_STATUS_SUITABLE_FOR_DEFAULT_TRANSFER: Int

Indicates the route is always suitable for media playback.

Value: 0

SUITABILITY_STATUS_SUITABLE_FOR_MANUAL_TRANSFER

Added in API level 35
static val SUITABILITY_STATUS_SUITABLE_FOR_MANUAL_TRANSFER: Int

Indicates that the route is suitable for media playback only after explicit user selection.

Value: 1

TYPE_AUX_LINE

Added in API level 36
static val TYPE_AUX_LINE: Int

Indicates the route is using the auxiliary line-level connectors.

Value: 19

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

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

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

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

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

TYPE_HDMI_ARC

Added in API level 35
static val TYPE_HDMI_ARC: Int

Indicates the route is an Audio Return Channel of an HDMI connection.

Value: 10

TYPE_HDMI_EARC

Added in API level 35
static val TYPE_HDMI_EARC: Int

Indicates the route is an Enhanced Audio Return Channel of an HDMI connection.

Value: 29

TYPE_HEARING_AID

Added in API level 34
static val TYPE_HEARING_AID: Int

Indicates the route is a hearing aid.

Value: 23

TYPE_LINE_ANALOG

Added in API level 36
static val TYPE_LINE_ANALOG: Int

Indicates the route is an analog line-level connection.

Value: 5

TYPE_LINE_DIGITAL

Added in API level 36
static val TYPE_LINE_DIGITAL: Int

Indicates the route is a digital line connection (for example S/PDIF).

Value: 6

TYPE_MULTICHANNEL_SPEAKER_GROUP

Added in API level 36
static val TYPE_MULTICHANNEL_SPEAKER_GROUP: Int

Indicates the route is a speaker group supporting multichannel contents.

The speakers in the group are connected together using local network based protocols. The speaker group requires additional input of the physical positions of each individual speaker to provide a better experience on multichannel contents.

Value: 32

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

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

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

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

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

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

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

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

TYPE_USB_DEVICE

Added in API level 34
static val TYPE_USB_DEVICE: Int

Indicates the route is a USB audio device.

Value: 11

TYPE_USB_HEADSET

Added in API level 34
static val TYPE_USB_HEADSET: Int

Indicates the route is a USB audio headset.

Value: 22

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

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

Public methods

describeContents

Added in API level 30
fun describeContents(): Int

Describe the kinds of special objects contained in this Parcelable instance's marshaled representation. For example, if the object will include a file descriptor in the output of writeToParcel(android.os.Parcel,int), the return value of this method must include the CONTENTS_FILE_DESCRIPTOR bit.

Return
Int a bitmask indicating the set of special object types marshaled by this Parcelable object instance.
Value is either 0 or

equals

Added in API level 30
fun equals(other: Any?): Boolean

Indicates whether some other object is "equal to" this one.

The equals method implements an equivalence relation on non-null object references:

  • It is reflexive: for any non-null reference value x, x.equals(x) should return true.
  • It is symmetric: for any non-null reference values x and y, x.equals(y) should return true if and only if y.equals(x) returns true.
  • It is transitive: for any non-null reference values x, y, and z, if x.equals(y) returns true and y.equals(z) returns true, then x.equals(z) should return true.
  • It is consistent: for any non-null reference values x and y, multiple invocations of x.equals(y) consistently return true or consistently return false, provided no information used in equals comparisons on the objects is modified.
  • For any non-null reference value x, x.equals(null) should return false.

An equivalence relation partitions the elements it operates on into equivalence classes; all the members of an equivalence class are equal to each other. Members of an equivalence class are substitutable for each other, at least for some purposes.

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.

getConnectionState

Added in API level 30
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.
Value is one of the following:

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 unique id of the route, if available. Otherwise, returns the original id set by Builder.Builder(String, CharSequence).

The original id of a route is the id set by the Builder when the route is built.

The unique id of a route is based on the original id, and assigned by the system once a route is published by calling MediaRoute2ProviderService.notifyRoutes(Collection). This ensures id uniqueness across routes from different providers, who assign original ids which are only unique within the scope of a single provider. As a result, calling this method on a route freshly created (which has not yet been published through MediaRoute2ProviderService.notifyRoutes(Collection)) will return the original id, and will differ from the unique id obtained from calling this method on a route obtained through MediaRouter2.

Routes obtained from MediaRouter2 will have unique IDs. For example, routes obtained through MediaRouter2.getRoutes(), MediaRouter2.RouteCallback.onRoutesUpdated(List), or MediaRouter2.RoutingController.getSelectedRoutes().

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.

getRequiredPermissions

fun getRequiredPermissions(): MutableList<MutableSet<String!>!>
Return
MutableList<MutableSet<String!>!> a list of permission sets - all the permissions in at least one of these sets must be held to see this route.
This value cannot be null.

getSuitabilityStatus

Added in API level 35
fun getSuitabilityStatus(): Int

Returns the route suitability status.

Return
Int Value is one of the following:

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 one of the following:

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

Returns a hash code value for the object. This method is supported for the benefit of hash tables such as those provided by java.util.HashMap.

The general contract of hashCode is:

  • Whenever it is invoked on the same object more than once during an execution of a Java application, the hashCode method must consistently return the same integer, provided no information used in equals comparisons on the object is modified. This integer need not remain consistent from one execution of an application to another execution of the same application.
  • If two objects are equal according to the equals method, then calling the hashCode method on each of the two objects must produce the same integer result.
  • It is not required that if two objects are unequal according to the equals method, then calling the hashCode method on each of the two objects must produce distinct integer results. However, the programmer should be aware that producing distinct integer results for unequal objects may improve the performance of hash tables.
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

Returns a string representation of the object.

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 the following:

Properties

CREATOR

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