public final class

MediaRouteDescriptor.Builder

extends java.lang.Object

 java.lang.Object

↳androidx.mediarouter.media.MediaRouteDescriptor.Builder

Overview

Builder for media route descriptors.

Summary

Constructors
publicBuilder(MediaRouteDescriptor descriptor)

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

publicBuilder(java.lang.String id, java.lang.String name)

Creates a media route descriptor builder.

Methods
public MediaRouteDescriptor.BuilderaddControlFilter(IntentFilter filter)

Adds a media control intent filter for the route.

public MediaRouteDescriptor.BuilderaddControlFilters(java.util.Collection<IntentFilter> filters)

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

public MediaRouteDescriptor.BuilderaddGroupMemberId(java.lang.String groupMemberId)

Adds a group member id of the route.

public MediaRouteDescriptor.BuilderaddGroupMemberIds(java.util.Collection<java.lang.String> groupMemberIds)

Adds a list of group member ids of the route.

public MediaRouteDescriptorbuild()

Builds the media route descriptor.

public MediaRouteDescriptor.BuilderclearGroupMemberIds()

Clears the group member IDs of the route.

public MediaRouteDescriptor.BuilderremoveGroupMemberId(java.lang.String memberRouteId)

Removes a group member id from the route's member list.

public MediaRouteDescriptor.BuildersetCanDisconnect(boolean canDisconnect)

Sets whether the route can be disconnected without stopping playback.

public MediaRouteDescriptor.BuildersetConnecting(boolean connecting)

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

public MediaRouteDescriptor.BuildersetConnectionState(int connectionState)

Sets the route's connection state.

public MediaRouteDescriptor.BuildersetDescription(java.lang.String description)

Sets the user-visible description of the route.

public MediaRouteDescriptor.BuildersetDeviceType(int deviceType)

Sets the route's receiver device type.

public MediaRouteDescriptor.BuildersetEnabled(boolean enabled)

Sets whether the route is enabled.

public MediaRouteDescriptor.BuildersetExtras(Bundle extras)

Sets a bundle of extras for this route descriptor.

public MediaRouteDescriptor.BuildersetIconUri(Uri iconUri)

Sets the URI of the icon representing this route.

public MediaRouteDescriptor.BuildersetId(java.lang.String id)

Sets the unique id of the route.

public MediaRouteDescriptor.BuildersetIsDynamicGroupRoute(boolean isDynamicGroupRoute)

Sets whether the route is a dynamic group route.

public MediaRouteDescriptor.BuildersetMaxClientVersion(int maxVersion)

Sets the route's maximum client version.

public MediaRouteDescriptor.BuildersetMinClientVersion(int minVersion)

Sets the route's minimum client version.

public MediaRouteDescriptor.BuildersetName(java.lang.String name)

Sets the user-visible name of the route.

public MediaRouteDescriptor.BuildersetPlaybackStream(int playbackStream)

Sets the route's playback stream.

public MediaRouteDescriptor.BuildersetPlaybackType(int playbackType)

Sets the route's playback type.

public MediaRouteDescriptor.BuildersetPresentationDisplayId(int presentationDisplayId)

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

public MediaRouteDescriptor.BuildersetSettingsActivity(IntentSender is)

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

public MediaRouteDescriptor.BuildersetVolume(int volume)

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

public MediaRouteDescriptor.BuildersetVolumeHandling(int volumeHandling)

Sets the route's volume handling.

public MediaRouteDescriptor.BuildersetVolumeMax(int volumeMax)

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

from java.lang.Objectclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

Constructors

public Builder(java.lang.String id, java.lang.String name)

Creates a media route descriptor builder.

Parameters:

id: The unique id of the route.
name: The user-visible name of the route.

public Builder(MediaRouteDescriptor descriptor)

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

Methods

public MediaRouteDescriptor.Builder setId(java.lang.String id)

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.

public MediaRouteDescriptor.Builder clearGroupMemberIds()

Clears the group member IDs of the route.

public MediaRouteDescriptor.Builder addGroupMemberId(java.lang.String groupMemberId)

Adds a group member id of the route.

A route descriptor that has one or more group member route ids represents a route group. A member route may belong to another group.

public MediaRouteDescriptor.Builder addGroupMemberIds(java.util.Collection<java.lang.String> groupMemberIds)

Adds a list of group member ids of the route.

A route descriptor that has one or more group member route ids represents a route group. A member route may belong to another group.

public MediaRouteDescriptor.Builder removeGroupMemberId(java.lang.String memberRouteId)

Removes a group member id from the route's member list.

A route descriptor that has one or more group member route ids represents a route group. A member route may belong to another group.

public MediaRouteDescriptor.Builder setName(java.lang.String name)

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.

public MediaRouteDescriptor.Builder setDescription(java.lang.String description)

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.

public MediaRouteDescriptor.Builder setIconUri(Uri iconUri)

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:

  • content ()
  • android.resource ()
  • file ()

public MediaRouteDescriptor.Builder setEnabled(boolean enabled)

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.

public MediaRouteDescriptor.Builder setIsDynamicGroupRoute(boolean isDynamicGroupRoute)

Sets whether the route is a dynamic group route.

See also: MediaRouteDescriptor.isDynamicGroupRoute()

public MediaRouteDescriptor.Builder setConnecting(boolean connecting)

Deprecated: Use MediaRouteDescriptor.Builder.setConnectionState(int) instead.

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

public MediaRouteDescriptor.Builder setConnectionState(int connectionState)

Sets the route's connection state.

Parameters:

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

public MediaRouteDescriptor.Builder setCanDisconnect(boolean canDisconnect)

Sets whether the route can be disconnected without stopping playback.

public MediaRouteDescriptor.Builder setSettingsActivity(IntentSender is)

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

public MediaRouteDescriptor.Builder addControlFilter(IntentFilter filter)

Adds a media control intent filter for the route.

public MediaRouteDescriptor.Builder addControlFilters(java.util.Collection<IntentFilter> filters)

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

public MediaRouteDescriptor.Builder setPlaybackType(int playbackType)

Sets the route's playback type.

Parameters:

playbackType: The playback type of the route: MediaRouter.RouteInfo.PLAYBACK_TYPE_LOCAL or MediaRouter.RouteInfo.PLAYBACK_TYPE_REMOTE.

public MediaRouteDescriptor.Builder setPlaybackStream(int playbackStream)

Sets the route's playback stream.

public MediaRouteDescriptor.Builder setDeviceType(int deviceType)

Sets the route's receiver device type.

Parameters:

deviceType: The receive device type of the route: MediaRouter.RouteInfo.DEVICE_TYPE_TV or MediaRouter.RouteInfo.DEVICE_TYPE_SPEAKER.

public MediaRouteDescriptor.Builder setVolume(int volume)

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

public MediaRouteDescriptor.Builder setVolumeMax(int volumeMax)

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

public MediaRouteDescriptor.Builder setVolumeHandling(int volumeHandling)

Sets the route's volume handling.

Parameters:

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

public MediaRouteDescriptor.Builder setPresentationDisplayId(int presentationDisplayId)

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

public MediaRouteDescriptor.Builder setExtras(Bundle extras)

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.

public MediaRouteDescriptor.Builder setMinClientVersion(int minVersion)

Sets the route's minimum client version. A router whose version is lower than this will not be able to connect to this route.

public MediaRouteDescriptor.Builder setMaxClientVersion(int maxVersion)

Sets the route's maximum client version. A router whose version is higher than this will not be able to connect to this route.

public MediaRouteDescriptor build()

Builds the media route descriptor.