MediaRouteDescriptor.Builder


class MediaRouteDescriptor.Builder


Builder for media route descriptors.

Summary

Public constructors

Creates a media route descriptor builder whose initial contents are copied from an existing descriptor.

Builder(id: String, name: String)

Creates a media route descriptor builder.

Public functions

MediaRouteDescriptor.Builder

Adds a media control intent filter for the route.

MediaRouteDescriptor.Builder

Adds a list of media control intent filters for the route.

MediaRouteDescriptor

Builds the media route descriptor.

MediaRouteDescriptor.Builder

Clears media control intent filters for the route.

MediaRouteDescriptor.Builder
setCanDisconnect(canDisconnect: Boolean)

Sets whether the route can be disconnected without stopping playback.

MediaRouteDescriptor.Builder
setConnecting(connecting: Boolean)

This function is deprecated.

Use setConnectionState instead.

MediaRouteDescriptor.Builder
setConnectionState(connectionState: Int)

Sets the route's connection state.

MediaRouteDescriptor.Builder
setDeduplicationIds(deduplicationIds: (Mutable)Set<String!>)

Sets the route's deduplication ids.

MediaRouteDescriptor.Builder
setDescription(description: String?)

Sets the user-visible description of the route.

MediaRouteDescriptor.Builder
setDeviceType(deviceType: Int)

Sets the route's receiver device type.

MediaRouteDescriptor.Builder
setEnabled(enabled: Boolean)

Sets whether the route is enabled.

MediaRouteDescriptor.Builder
setExtras(extras: Bundle?)

Sets a bundle of extras for this route descriptor.

MediaRouteDescriptor.Builder
setIconUri(iconUri: Uri)

Sets the URI of the icon representing this route.

MediaRouteDescriptor.Builder

Sets the unique id of the route.

MediaRouteDescriptor.Builder
setIsDynamicGroupRoute(isDynamicGroupRoute: Boolean)

Sets whether the route is a dynamic group route.

MediaRouteDescriptor.Builder
setName(name: String)

Sets the user-visible name of the route.

MediaRouteDescriptor.Builder
setPlaybackStream(playbackStream: Int)

Sets the route's playback stream.

MediaRouteDescriptor.Builder
setPlaybackType(playbackType: Int)

Sets the route's playback type.

MediaRouteDescriptor.Builder
setPresentationDisplayId(presentationDisplayId: Int)

Sets the route's presentation display id, or -1 if none.

MediaRouteDescriptor.Builder

Sets an intent sender for launching the settings activity for this route.

MediaRouteDescriptor.Builder

Sets the visibility of this route to public.

MediaRouteDescriptor.Builder

Sets the visibility of this route to restricted.

MediaRouteDescriptor.Builder
setVolume(volume: Int)

Sets the route's current volume, or 0 if unknown.

MediaRouteDescriptor.Builder
setVolumeHandling(volumeHandling: Int)

Sets the route's volume handling.

MediaRouteDescriptor.Builder
setVolumeMax(volumeMax: Int)

Sets the route's maximum volume, or 0 if unknown.

Public constructors

Builder

Added in 1.1.0
Builder(descriptor: MediaRouteDescriptor)

Creates a media route descriptor builder whose initial contents are copied from an existing descriptor.

Builder

Added in 1.1.0
Builder(id: String, name: String)

Creates a media route descriptor builder.

Parameters
id: String

The unique id of the route.

name: String

The user-visible name of the route.

Public functions

addControlFilter

Added in 1.1.0
fun addControlFilter(filter: IntentFilter): MediaRouteDescriptor.Builder

Adds a media control intent filter for the route.

addControlFilters

Added in 1.1.0
fun addControlFilters(filters: (Mutable)Collection<IntentFilter!>): MediaRouteDescriptor.Builder

Adds a list of media control intent filters for the route.

build

Added in 1.1.0
fun build(): MediaRouteDescriptor

Builds the media route descriptor.

clearControlFilters

Added in 1.4.0
fun clearControlFilters(): MediaRouteDescriptor.Builder

Clears media control intent filters for the route.

setCanDisconnect

Added in 1.1.0
fun setCanDisconnect(canDisconnect: Boolean): MediaRouteDescriptor.Builder

Sets whether the route can be disconnected without stopping playback.

setConnecting

Added in 1.1.0
Deprecated in 1.1.0
fun setConnecting(connecting: Boolean): MediaRouteDescriptor.Builder

Sets whether the route is in the process of connecting and is not yet ready for use.

setConnectionState

Added in 1.1.0
fun setConnectionState(connectionState: Int): MediaRouteDescriptor.Builder

Sets the route's connection state.

Parameters
connectionState: Int

The connection state of the route: CONNECTION_STATE_DISCONNECTED, CONNECTION_STATE_CONNECTING, or CONNECTION_STATE_CONNECTED.

setDeduplicationIds

Added in 1.6.0
fun setDeduplicationIds(deduplicationIds: (Mutable)Set<String!>): MediaRouteDescriptor.Builder

Sets the route's deduplication ids.

Two routes are considered to come from the same receiver device if any of their respective deduplication ids match.

Parameters
deduplicationIds: (Mutable)Set<String!>

A set of strings that uniquely identify the receiver device that backs this route.

setDescription

Added in 1.1.0
fun setDescription(description: String?): MediaRouteDescriptor.Builder

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

setDeviceType

Added in 1.1.0
fun setDeviceType(deviceType: Int): MediaRouteDescriptor.Builder

Sets the route's receiver device type.

Parameters
deviceType: Int

The type of the receiver device.

setEnabled

Added in 1.1.0
fun setEnabled(enabled: Boolean): MediaRouteDescriptor.Builder

Sets whether the route is enabled.

Disabled routes represent routes that a route provider knows about, such as paired Wifi Display receivers, but that are not currently available for use.

setExtras

Added in 1.1.0
fun setExtras(extras: Bundle?): MediaRouteDescriptor.Builder

Sets a bundle of extras for this route descriptor. The extras will be ignored by the media router but they may be used by applications.

setIconUri

Added in 1.1.0
fun setIconUri(iconUri: Uri): MediaRouteDescriptor.Builder

Sets the URI of the icon representing this route.

This icon will be used in picker UIs if available.

The URI must be one of the following formats:

setId

Added in 1.1.0
fun setId(id: String): MediaRouteDescriptor.Builder

Sets the unique id of the route.

The route id associated with a route descriptor functions as a stable identifier for the route and must be unique among all routes offered by the provider.

setIsDynamicGroupRoute

Added in 1.1.0
fun setIsDynamicGroupRoute(isDynamicGroupRoute: Boolean): MediaRouteDescriptor.Builder

Sets whether the route is a dynamic group route.

setName

Added in 1.1.0
fun setName(name: String): MediaRouteDescriptor.Builder

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

setPlaybackStream

Added in 1.1.0
fun setPlaybackStream(playbackStream: Int): MediaRouteDescriptor.Builder

Sets the route's playback stream.

setPlaybackType

Added in 1.1.0
fun setPlaybackType(playbackType: Int): MediaRouteDescriptor.Builder

Sets the route's playback type.

Parameters
playbackType: Int

The playback type of the route: PLAYBACK_TYPE_LOCAL or PLAYBACK_TYPE_REMOTE.

setPresentationDisplayId

Added in 1.1.0
fun setPresentationDisplayId(presentationDisplayId: Int): MediaRouteDescriptor.Builder

Sets the route's presentation display id, or -1 if none.

setSettingsActivity

Added in 1.1.0
fun setSettingsActivity(is: IntentSender?): MediaRouteDescriptor.Builder

Sets an intent sender for launching the settings activity for this route.

setVisibilityPublic

Added in 1.6.0
fun setVisibilityPublic(): MediaRouteDescriptor.Builder

Sets the visibility of this route to public.

By default, unless you call setVisibilityRestricted, the new route will be public.

Public routes are visible to any application with a matching feature.

Calls to this method override previous calls to setVisibilityPublic and setVisibilityRestricted.

setVisibilityRestricted

Added in 1.6.0
fun setVisibilityRestricted(allowedPackages: (Mutable)Set<String!>): MediaRouteDescriptor.Builder

Sets the visibility of this route to restricted.

Routes with restricted visibility are only visible to its publisher application and applications whose package name is included in the provided allowedPackages set with a matching feature.

Calls to this method override previous calls to setVisibilityPublic and setVisibilityRestricted.

Parameters
allowedPackages: (Mutable)Set<String!>

set of package names which are allowed to see this route.

setVolume

Added in 1.1.0
fun setVolume(volume: Int): MediaRouteDescriptor.Builder

Sets the route's current volume, or 0 if unknown.

setVolumeHandling

Added in 1.1.0
fun setVolumeHandling(volumeHandling: Int): MediaRouteDescriptor.Builder

Sets the route's volume handling.

Parameters
volumeHandling: Int

how volume is handled on the route: PLAYBACK_VOLUME_FIXED or PLAYBACK_VOLUME_VARIABLE.

setVolumeMax

Added in 1.1.0
fun setVolumeMax(volumeMax: Int): MediaRouteDescriptor.Builder

Sets the route's maximum volume, or 0 if unknown.