# NotificationOptions.Builder

public static final class **NotificationOptions.Builder** extends [Object](https://developer.android.com/reference/java/lang/Object.html)  
A builder for creating an instance of `https://developers.google.com/android/reference/com/google/android/gms/cast/framework/media/NotificationOptions`.

### Public Constructor Summary

|---|---|
|   | [Builder](https://developers.google.com/android/reference/com/google/android/gms/cast/framework/media/NotificationOptions.Builder#Builder())() |

### Public Method Summary

|---|---|
| [NotificationOptions](https://developers.google.com/android/reference/com/google/android/gms/cast/framework/media/NotificationOptions) | [build](https://developers.google.com/android/reference/com/google/android/gms/cast/framework/media/NotificationOptions.Builder#build())() Builds and returns the `https://developers.google.com/android/reference/com/google/android/gms/cast/framework/media/NotificationOptions` object. |
| [NotificationOptions.Builder](https://developers.google.com/android/reference/com/google/android/gms/cast/framework/media/NotificationOptions.Builder) | [setActions](https://developers.google.com/android/reference/com/google/android/gms/cast/framework/media/NotificationOptions.Builder#setActions(java.util.List<java.lang.String>,%20int[]))([List](https://developer.android.com/reference/java/util/List.html)\<[String](https://developer.android.com/reference/java/lang/String.html)\> actions, int\[\] compatActionIndices) Sets at most 5 actions to show in the notification, and the indices to the actions to show in the compact view. |
| [NotificationOptions.Builder](https://developers.google.com/android/reference/com/google/android/gms/cast/framework/media/NotificationOptions.Builder) | [setDisconnectDrawableResId](https://developers.google.com/android/reference/com/google/android/gms/cast/framework/media/NotificationOptions.Builder#setDisconnectDrawableResId(int))(int resId) Sets the resource ID of the icon that indicates "disconnect". |
| [NotificationOptions.Builder](https://developers.google.com/android/reference/com/google/android/gms/cast/framework/media/NotificationOptions.Builder) | [setForward10DrawableResId](https://developers.google.com/android/reference/com/google/android/gms/cast/framework/media/NotificationOptions.Builder#setForward10DrawableResId(int))(int resId) Sets the resource ID of the icon that indicates "skip forward 10 seconds". |
| [NotificationOptions.Builder](https://developers.google.com/android/reference/com/google/android/gms/cast/framework/media/NotificationOptions.Builder) | [setForward30DrawableResId](https://developers.google.com/android/reference/com/google/android/gms/cast/framework/media/NotificationOptions.Builder#setForward30DrawableResId(int))(int resId) Sets the resource ID of the icon that indicates "skip forward 30 seconds". |
| [NotificationOptions.Builder](https://developers.google.com/android/reference/com/google/android/gms/cast/framework/media/NotificationOptions.Builder) | [setForwardDrawableResId](https://developers.google.com/android/reference/com/google/android/gms/cast/framework/media/NotificationOptions.Builder#setForwardDrawableResId(int))(int resId) Sets the resource ID of the icon that indicates "skip forward". |
| [NotificationOptions.Builder](https://developers.google.com/android/reference/com/google/android/gms/cast/framework/media/NotificationOptions.Builder) | [setNotificationActionsProvider](https://developers.google.com/android/reference/com/google/android/gms/cast/framework/media/NotificationOptions.Builder#setNotificationActionsProvider(com.google.android.gms.cast.framework.media.NotificationActionsProvider))([NotificationActionsProvider](https://developers.google.com/android/reference/com/google/android/gms/cast/framework/media/NotificationActionsProvider) notificationActionsProvider) Sets a `https://developers.google.com/android/reference/com/google/android/gms/cast/framework/media/NotificationActionsProvider`, which can be subclassed to provide dynamic custom actions. |
| [NotificationOptions.Builder](https://developers.google.com/android/reference/com/google/android/gms/cast/framework/media/NotificationOptions.Builder) | [setPauseDrawableResId](https://developers.google.com/android/reference/com/google/android/gms/cast/framework/media/NotificationOptions.Builder#setPauseDrawableResId(int))(int resId) Sets the resource ID of the icon that indicates "pause". |
| [NotificationOptions.Builder](https://developers.google.com/android/reference/com/google/android/gms/cast/framework/media/NotificationOptions.Builder) | [setPlayDrawableResId](https://developers.google.com/android/reference/com/google/android/gms/cast/framework/media/NotificationOptions.Builder#setPlayDrawableResId(int))(int resId) Sets the resource ID of the icon that indicates "play". |
| [NotificationOptions.Builder](https://developers.google.com/android/reference/com/google/android/gms/cast/framework/media/NotificationOptions.Builder) | [setRewind10DrawableResId](https://developers.google.com/android/reference/com/google/android/gms/cast/framework/media/NotificationOptions.Builder#setRewind10DrawableResId(int))(int resId) Sets the resource ID of the icon that indicates "rewind 10 seconds". |
| [NotificationOptions.Builder](https://developers.google.com/android/reference/com/google/android/gms/cast/framework/media/NotificationOptions.Builder) | [setRewind30DrawableResId](https://developers.google.com/android/reference/com/google/android/gms/cast/framework/media/NotificationOptions.Builder#setRewind30DrawableResId(int))(int resId) Sets the resource ID of the icon that indicates "rewind 30 seconds". |
| [NotificationOptions.Builder](https://developers.google.com/android/reference/com/google/android/gms/cast/framework/media/NotificationOptions.Builder) | [setRewindDrawableResId](https://developers.google.com/android/reference/com/google/android/gms/cast/framework/media/NotificationOptions.Builder#setRewindDrawableResId(int))(int resId) Sets the resource ID of the icon that indicates "rewind". |
| [NotificationOptions.Builder](https://developers.google.com/android/reference/com/google/android/gms/cast/framework/media/NotificationOptions.Builder) | [setSkipNextDrawableResId](https://developers.google.com/android/reference/com/google/android/gms/cast/framework/media/NotificationOptions.Builder#setSkipNextDrawableResId(int))(int resId) Sets the resource ID of the icon that indicates "skip next". |
| [NotificationOptions.Builder](https://developers.google.com/android/reference/com/google/android/gms/cast/framework/media/NotificationOptions.Builder) | [setSkipPrevDrawableResId](https://developers.google.com/android/reference/com/google/android/gms/cast/framework/media/NotificationOptions.Builder#setSkipPrevDrawableResId(int))(int resId) Sets the resource ID of the icon that indicates "skip previous". |
| [NotificationOptions.Builder](https://developers.google.com/android/reference/com/google/android/gms/cast/framework/media/NotificationOptions.Builder) | [setSkipStepMs](https://developers.google.com/android/reference/com/google/android/gms/cast/framework/media/NotificationOptions.Builder#setSkipStepMs(long))(long notificationSkipStepMs) Sets the amount to jump if `https://developers.google.com/android/reference/com/google/android/gms/cast/framework/media/MediaIntentReceiver#ACTION_FORWARD` or `https://developers.google.com/android/reference/com/google/android/gms/cast/framework/media/MediaIntentReceiver#ACTION_REWIND` are included for the notification actions. |
| [NotificationOptions.Builder](https://developers.google.com/android/reference/com/google/android/gms/cast/framework/media/NotificationOptions.Builder) | [setSkipToNextSlotReserved](https://developers.google.com/android/reference/com/google/android/gms/cast/framework/media/NotificationOptions.Builder#setSkipToNextSlotReserved(boolean))(boolean skipToNextSlotReserved) Sets `true` to reserve the slot of skip-to-next action for Android T or above. |
| [NotificationOptions.Builder](https://developers.google.com/android/reference/com/google/android/gms/cast/framework/media/NotificationOptions.Builder) | [setSkipToPrevSlotReserved](https://developers.google.com/android/reference/com/google/android/gms/cast/framework/media/NotificationOptions.Builder#setSkipToPrevSlotReserved(boolean))(boolean skipToPrevSlotReserved) Sets `true` to reserve the slot of skip-to-previous action for Android T or above. |
| [NotificationOptions.Builder](https://developers.google.com/android/reference/com/google/android/gms/cast/framework/media/NotificationOptions.Builder) | [setSmallIconDrawableResId](https://developers.google.com/android/reference/com/google/android/gms/cast/framework/media/NotificationOptions.Builder#setSmallIconDrawableResId(int))(int resId) Sets the resource ID for the notification icon drawable. |
| [NotificationOptions.Builder](https://developers.google.com/android/reference/com/google/android/gms/cast/framework/media/NotificationOptions.Builder) | [setStopLiveStreamDrawableResId](https://developers.google.com/android/reference/com/google/android/gms/cast/framework/media/NotificationOptions.Builder#setStopLiveStreamDrawableResId(int))(int resId) Sets the resource ID of the icon that indicates "stop playing live stream". |
| [NotificationOptions.Builder](https://developers.google.com/android/reference/com/google/android/gms/cast/framework/media/NotificationOptions.Builder) | [setTargetActivityClassName](https://developers.google.com/android/reference/com/google/android/gms/cast/framework/media/NotificationOptions.Builder#setTargetActivityClassName(java.lang.String))([String](https://developer.android.com/reference/java/lang/String.html) className) Sets the name of the `https://developer.android.com/reference/android/app/Activity.html` that will be launched when user taps on the content area of the notification. |

### Inherited Method Summary

From class java.lang.Object

|---|---|
| [Object](https://developer.android.com/reference/java/lang/Object.html) | clone() |
| boolean | equals([Object](https://developer.android.com/reference/java/lang/Object.html) arg0) |
| void | finalize() |
| final [Class](https://developer.android.com/reference/java/lang/Class.html)\<?\> | getClass() |
| int | hashCode() |
| final void | notify() |
| final void | notifyAll() |
| [String](https://developer.android.com/reference/java/lang/String.html) | toString() |
| final void | wait(long arg0, int arg1) |
| final void | wait(long arg0) |
| final void | wait() |

## Public Constructors

#### public **Builder** ()

## Public Methods

#### public [NotificationOptions](https://developers.google.com/android/reference/com/google/android/gms/cast/framework/media/NotificationOptions)
**build** ()

Builds and returns the `https://developers.google.com/android/reference/com/google/android/gms/cast/framework/media/NotificationOptions` object.

#### public [NotificationOptions.Builder](https://developers.google.com/android/reference/com/google/android/gms/cast/framework/media/NotificationOptions.Builder) **setActions** ([List](https://developer.android.com/reference/java/util/List.html)\<[String](https://developer.android.com/reference/java/lang/String.html)\> actions, int\[\] compatActionIndices)

Sets at most 5 actions to show in the notification, and the indices to the actions
to show in the compact view. If both `actions` and
`compatActionIndices` are `null`, the default values,
`https://developers.google.com/android/reference/com/google/android/gms/cast/framework/media/MediaIntentReceiver#ACTION_TOGGLE_PLAYBACK` and `https://developers.google.com/android/reference/com/google/android/gms/cast/framework/media/MediaIntentReceiver#ACTION_STOP_CASTING` will be used.

The list of actions that can be set through this method is defined in `https://developers.google.com/android/reference/com/google/android/gms/cast/framework/media/MediaIntentReceiver`. To provide a dynamic custom action, set a
`https://developers.google.com/android/reference/com/google/android/gms/cast/framework/media/NotificationActionsProvider` using the `https://developers.google.com/android/reference/com/google/android/gms/cast/framework/media/NotificationOptions.Builder#setNotificationActionsProvider(com.google.android.gms.cast.framework.media.NotificationActionsProvider)` method below. If
a `https://developers.google.com/android/reference/com/google/android/gms/cast/framework/media/NotificationActionsProvider` is set, the SDK will use it to get the list of
actions and the indices that should appear in the compact view, instead of the values
provided here. See `https://developers.google.com/android/reference/com/google/android/gms/cast/framework/media/NotificationActionsProvider` for how to implement dynamic custom actions.

##### Parameters

| actions | The list of actions, defined in `https://developers.google.com/android/reference/com/google/android/gms/cast/framework/media/MediaIntentReceiver`. |
| compatActionIndices | Indices of the actions in the `actions` list, which will be shown in the compact view. |
|---|---|

##### Throws

| [IllegalArgumentException](https://developer.android.com/reference/java/lang/IllegalArgumentException.html) | If `actions` and `compatActionIndices` are not either both `null` or `non-null`, or if the length of `compatActionIndices` is greater than the size of `actions`, or if any index in `compatActionIndices` is out of range. |
|---|---|

##### See Also

- `https://developers.google.com/android/reference/com/google/android/gms/cast/framework/media/MediaIntentReceiver`

#### public [NotificationOptions.Builder](https://developers.google.com/android/reference/com/google/android/gms/cast/framework/media/NotificationOptions.Builder) **setDisconnectDrawableResId** (int resId)

Sets the resource ID of the icon that indicates "disconnect". By default, a drawable
`ic_notification_disconnect.xml` from the SDK is used.

#### public [NotificationOptions.Builder](https://developers.google.com/android/reference/com/google/android/gms/cast/framework/media/NotificationOptions.Builder) **setForward10DrawableResId** (int resId)

Sets the resource ID of the icon that indicates "skip forward 10 seconds". By
default, a drawable `ic_notification_forward10.xml` from the SDK is
used.

#### public [NotificationOptions.Builder](https://developers.google.com/android/reference/com/google/android/gms/cast/framework/media/NotificationOptions.Builder) **setForward30DrawableResId** (int resId)

Sets the resource ID of the icon that indicates "skip forward 30 seconds". By
default, a drawable `ic_notification_forward30.xml` from the SDK is
used.

#### public [NotificationOptions.Builder](https://developers.google.com/android/reference/com/google/android/gms/cast/framework/media/NotificationOptions.Builder) **setForwardDrawableResId** (int resId)

Sets the resource ID of the icon that indicates "skip forward". By default, a
drawable `ic_notification_forward.xml` from the SDK is used.

#### public [NotificationOptions.Builder](https://developers.google.com/android/reference/com/google/android/gms/cast/framework/media/NotificationOptions.Builder) **setNotificationActionsProvider** ([NotificationActionsProvider](https://developers.google.com/android/reference/com/google/android/gms/cast/framework/media/NotificationActionsProvider) notificationActionsProvider)

Sets a `https://developers.google.com/android/reference/com/google/android/gms/cast/framework/media/NotificationActionsProvider`, which can be subclassed to provide dynamic
custom actions. If set, the SDK will use it to get the list of actions and the indices
that should appear in the compact view. If not set, the SDK will use the value provided
by the call to `https://developers.google.com/android/reference/com/google/android/gms/cast/framework/media/NotificationOptions.Builder#setActions(java.util.List<java.lang.String>,%20int[])`.

See `https://developers.google.com/android/reference/com/google/android/gms/cast/framework/media/MediaIntentReceiver` for a list of predefined actions that you can use to
implement your `https://developers.google.com/android/reference/com/google/android/gms/cast/framework/media/NotificationActionsProvider`. See `https://developers.google.com/android/reference/com/google/android/gms/cast/framework/media/NotificationActionsProvider` for how to implement custom actions.

##### Parameters

| notificationActionsProvider | The `https://developers.google.com/android/reference/com/google/android/gms/cast/framework/media/NotificationActionsProvider` that provides the list of `https://developers.google.com/android/reference/com/google/android/gms/cast/framework/media/NotificationAction` that should appear in the expanded view and indices of actions that should appear in the compact view. |
|---|---|

##### Throws

| [IllegalArgumentException](https://developer.android.com/reference/java/lang/IllegalArgumentException.html) | If `notificationActionsProvider` is `null`. |
|---|---|

#### public [NotificationOptions.Builder](https://developers.google.com/android/reference/com/google/android/gms/cast/framework/media/NotificationOptions.Builder) **setPauseDrawableResId** (int resId)

Sets the resource ID of the icon that indicates "pause". By default, a drawable
`ic_notification_pause.xml` from the SDK is used.

#### public [NotificationOptions.Builder](https://developers.google.com/android/reference/com/google/android/gms/cast/framework/media/NotificationOptions.Builder) **setPlayDrawableResId** (int resId)

Sets the resource ID of the icon that indicates "play". By default, a drawable
`ic_notification_play.xml` from the SDK is used.

#### public [NotificationOptions.Builder](https://developers.google.com/android/reference/com/google/android/gms/cast/framework/media/NotificationOptions.Builder) **setRewind10DrawableResId** (int resId)

Sets the resource ID of the icon that indicates "rewind 10 seconds". By default, a
drawable `ic_notification_rewind10.xml` from the SDK is used.

#### public [NotificationOptions.Builder](https://developers.google.com/android/reference/com/google/android/gms/cast/framework/media/NotificationOptions.Builder) **setRewind30DrawableResId** (int resId)

Sets the resource ID of the icon that indicates "rewind 30 seconds". By default, a
drawable `ic_notification_rewind30.xml` from the SDK is used.

#### public [NotificationOptions.Builder](https://developers.google.com/android/reference/com/google/android/gms/cast/framework/media/NotificationOptions.Builder) **setRewindDrawableResId** (int resId)

Sets the resource ID of the icon that indicates "rewind". By default, a drawable
`ic_notification_rewind.xml` from the SDK is used.

#### public [NotificationOptions.Builder](https://developers.google.com/android/reference/com/google/android/gms/cast/framework/media/NotificationOptions.Builder) **setSkipNextDrawableResId** (int resId)

Sets the resource ID of the icon that indicates "skip next". By default, a drawable
`ic_notification_skip_next.xml` from the SDK is used.

#### public [NotificationOptions.Builder](https://developers.google.com/android/reference/com/google/android/gms/cast/framework/media/NotificationOptions.Builder) **setSkipPrevDrawableResId** (int resId)

Sets the resource ID of the icon that indicates "skip previous". By default, a
drawable `ic_notification_skip_prev.xml` from the SDK is used.

#### public [NotificationOptions.Builder](https://developers.google.com/android/reference/com/google/android/gms/cast/framework/media/NotificationOptions.Builder) **setSkipStepMs** (long notificationSkipStepMs)

Sets the amount to jump if `https://developers.google.com/android/reference/com/google/android/gms/cast/framework/media/MediaIntentReceiver#ACTION_FORWARD` or `https://developers.google.com/android/reference/com/google/android/gms/cast/framework/media/MediaIntentReceiver#ACTION_REWIND` are included for the notification actions.
Any tap on those actions will result in moving the media position forward or backward
by `notificationSkipStepMs` milliseconds. The default value is
`https://developers.google.com/android/reference/com/google/android/gms/cast/framework/media/NotificationOptions#SKIP_STEP_TEN_SECONDS_IN_MS`.

##### Parameters

| notificationSkipStepMs | The amount of time to skip, in milliseconds. |
|---|---|

##### Throws

| [IllegalArgumentException](https://developer.android.com/reference/java/lang/IllegalArgumentException.html) | if `notificationSkipStepMs` is not positive. |
|---|---|

#### public [NotificationOptions.Builder](https://developers.google.com/android/reference/com/google/android/gms/cast/framework/media/NotificationOptions.Builder) **setSkipToNextSlotReserved** (boolean skipToNextSlotReserved)

Sets `true` to reserve the slot of skip-to-next action for Android T or
above.

##### Parameters

| skipToNextSlotReserved | if the slot of skip-to-next action is reserved |
|---|---|

#### public [NotificationOptions.Builder](https://developers.google.com/android/reference/com/google/android/gms/cast/framework/media/NotificationOptions.Builder) **setSkipToPrevSlotReserved** (boolean skipToPrevSlotReserved)

Sets `true` to reserve the slot of skip-to-previous action for Android T
or above.

##### Parameters

| skipToPrevSlotReserved | if the slot of skip-to-previous action is reserved |
|---|---|

#### public [NotificationOptions.Builder](https://developers.google.com/android/reference/com/google/android/gms/cast/framework/media/NotificationOptions.Builder) **setSmallIconDrawableResId** (int resId)

Sets the resource ID for the notification icon drawable. By default, a drawable
`ic_notification_small_icon.xml` from the SDK is used.

#### public [NotificationOptions.Builder](https://developers.google.com/android/reference/com/google/android/gms/cast/framework/media/NotificationOptions.Builder) **setStopLiveStreamDrawableResId** (int resId)

Sets the resource ID of the icon that indicates "stop playing live stream". By
default, a drawable `ic_notification_stop_live_stream.xml` from the SDK is
used.

#### public [NotificationOptions.Builder](https://developers.google.com/android/reference/com/google/android/gms/cast/framework/media/NotificationOptions.Builder) **setTargetActivityClassName** ([String](https://developer.android.com/reference/java/lang/String.html) className)

Sets the name of the `https://developer.android.com/reference/android/app/Activity.html` that
will be launched when user taps on the content area of the notification. If set to
`null` then clicking on the content area will not launch any `https://developer.android.com/reference/android/app/Activity.html`. The
default value is `null`.