public static final class

CastOptions.Builder

extends Object
java.lang.Object
   ↳ com.google.android.gms.cast.framework.CastOptions.Builder

Class Overview

A builder to create an instance of CastOptions which is used to initialize the CastContext.

Summary

Public Constructors
CastOptions.Builder()
Public Methods
CastOptions build()
Builds and returns the CastOptions object.
CastOptions.Builder setCastMediaOptions(CastMediaOptions castMediaOptions)
Sets the CastMediaOptions that will be used to configure the media session.
CastOptions.Builder setEnableReconnectionService(boolean enableReconnectionService)
Sets whether ReconnectionService should be enabled when needed to better handle session recovery.
CastOptions.Builder setLaunchOptions(LaunchOptions launchOptions)
Sets the receiver launch options to use when launching the application.
CastOptions.Builder setReceiverApplicationId(String applicationId)
Sets the receiver application ID.
CastOptions.Builder setResumeSavedSession(boolean resumeSavedSession)
Sets whether the saved session should be resumed if it was dropped unexpectedly.
CastOptions.Builder setStopReceiverApplicationWhenEndingSession(boolean stopApp)
Specifies whether the receiver application should be terminated when a session is ended by the user.
CastOptions.Builder setSupportedNamespaces(List<String> supportedNamespaces)
Sets the list of supported namespaces.
CastOptions.Builder setVolumeDeltaBeforeIceCreamSandwich(double volumeDelta)
Sets the amount of receiver device volume to increase or decrease when the physical volume key is pressed on an Android device older than ICE CREAM SANDWICH.
[Expand]
Inherited Methods
From class java.lang.Object

Public Constructors

public CastOptions.Builder ()

Public Methods

public CastOptions build ()

Builds and returns the CastOptions object.

Returns
CastOptions

public CastOptions.Builder setCastMediaOptions (CastMediaOptions castMediaOptions)

Sets the CastMediaOptions that will be used to configure the media session.

Parameters
castMediaOptions CastMediaOptions: The CastMediaOptions.
Returns
CastOptions.Builder

public CastOptions.Builder setEnableReconnectionService (boolean enableReconnectionService)

Sets whether ReconnectionService should be enabled when needed to better handle session recovery. The default value is true.

Parameters
enableReconnectionService boolean: true if the ReconnectionService should be enabled, false if it should not be enabled.
Returns
CastOptions.Builder

public CastOptions.Builder setLaunchOptions (LaunchOptions launchOptions)

Sets the receiver launch options to use when launching the application. The default value is a default LaunchOptions.

Parameters
launchOptions LaunchOptions: The LaunchOptions.
Returns
CastOptions.Builder

public CastOptions.Builder setReceiverApplicationId (String applicationId)

Sets the receiver application ID. The default value is an empty string.

Parameters
applicationId String: The receiver application ID that will be used to discover the receiver device and launch the receiver application.
Returns
CastOptions.Builder

public CastOptions.Builder setResumeSavedSession (boolean resumeSavedSession)

Sets whether the saved session should be resumed if it was dropped unexpectedly. The default value is true.

Parameters
resumeSavedSession boolean: true if the saved session should be resumed, false if the saved session should not be resumed.
Returns
CastOptions.Builder

public CastOptions.Builder setStopReceiverApplicationWhenEndingSession (boolean stopApp)

Specifies whether the receiver application should be terminated when a session is ended by the user. The default value is false.

Parameters
stopApp boolean: true if the receiver application should be terminated when a session ended by the user, false if the receiver application should not be terminated in this case.
Returns
CastOptions.Builder

public CastOptions.Builder setSupportedNamespaces (List<String> supportedNamespaces)

Sets the list of supported namespaces. The default value is an empty list.

Parameters
supportedNamespaces List: The list of supported namespaces that is used to filter discovered receiver devices.
Returns
CastOptions.Builder

public CastOptions.Builder setVolumeDeltaBeforeIceCreamSandwich (double volumeDelta)

Sets the amount of receiver device volume to increase or decrease when the physical volume key is pressed on an Android device older than ICE CREAM SANDWICH. This value is not used on Android devices running ICE CREAM SANDWICH or newer. The system honors the system volume range of [0.0, 1.0]. If volumeDelta is set to 0.1, then every press of the "volume up" key will increase the volume by 10%.

Parameters
volumeDelta double: The amount of volume delta. The default value is 0.05.
Returns
CastOptions.Builder
Throws
IllegalArgumentException If volumeDelta is negative, zero or greater than 0.5.