# RoutingSessionInfo.Builder

Added in[API level 30](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

# Builder

*** ** * ** ***

Kotlin\|[Java](https://developer.android.com/reference/android/media/RoutingSessionInfo.Builder "View this page in Java")  

```
class Builder
```

|---|--------------------------------------------------------------------------------------------------------------------------------------|
| [kotlin.Any](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-any/index.html)                                                       ||
| ↳ | [android.media.RoutingSessionInfo.Builder](https://developer.android.com/reference/kotlin/android/media/RoutingSessionInfo.Builder#) |

Builder class for[RoutingSessionInfo](https://developer.android.com/reference/kotlin/android/media/RoutingSessionInfo).

## Summary

|                                                                                                                                                                                                                                                             Public constructors                                                                                                                                                                                                                                                             ||
|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|---|
| [Builder](https://developer.android.com/reference/kotlin/android/media/RoutingSessionInfo.Builder#Builder(android.media.RoutingSessionInfo))`(`sessionInfo:` `[RoutingSessionInfo](https://developer.android.com/reference/kotlin/android/media/RoutingSessionInfo)`)` Constructor for builder to create[RoutingSessionInfo](https://developer.android.com/reference/kotlin/android/media/RoutingSessionInfo)with existing[RoutingSessionInfo](https://developer.android.com/reference/kotlin/android/media/RoutingSessionInfo)instance. |
| [Builder](https://developer.android.com/reference/kotlin/android/media/RoutingSessionInfo.Builder#Builder(kotlin.String,%20kotlin.String))`(`originalId:` `[String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)`, `clientPackageName:` `[String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)`)` Constructor for builder to create[RoutingSessionInfo](https://developer.android.com/reference/kotlin/android/media/RoutingSessionInfo).                                          |

|                                                                                                                                                                                                                                                                                                              Public methods                                                                                                                                                                                                                                                                                                               ||
|------------------------------------------------------------------------------------------------------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| [RoutingSessionInfo.Builder](https://developer.android.com/reference/kotlin/android/media/RoutingSessionInfo.Builder#) | [addDeselectableRoute](https://developer.android.com/reference/kotlin/android/media/RoutingSessionInfo.Builder#addDeselectableRoute(kotlin.String))`(`routeId:` `[String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)`)` Adds a route to the deselectable routes.                                                                                                                                                                                                                     |
| [RoutingSessionInfo.Builder](https://developer.android.com/reference/kotlin/android/media/RoutingSessionInfo.Builder#) | [addSelectableRoute](https://developer.android.com/reference/kotlin/android/media/RoutingSessionInfo.Builder#addSelectableRoute(kotlin.String))`(`routeId:` `[String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)`)` Adds a route to the selectable routes.                                                                                                                                                                                                                           |
| [RoutingSessionInfo.Builder](https://developer.android.com/reference/kotlin/android/media/RoutingSessionInfo.Builder#) | [addSelectedRoute](https://developer.android.com/reference/kotlin/android/media/RoutingSessionInfo.Builder#addSelectedRoute(kotlin.String))`(`routeId:` `[String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)`)` Adds a route to the selected routes.                                                                                                                                                                                                                                 |
| [RoutingSessionInfo.Builder](https://developer.android.com/reference/kotlin/android/media/RoutingSessionInfo.Builder#) | [addTransferableRoute](https://developer.android.com/reference/kotlin/android/media/RoutingSessionInfo.Builder#addTransferableRoute(kotlin.String))`(`routeId:` `[String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)`)` Adds a route to the transferable routes.                                                                                                                                                                                                                     |
| [RoutingSessionInfo](https://developer.android.com/reference/kotlin/android/media/RoutingSessionInfo)                  | [build](https://developer.android.com/reference/kotlin/android/media/RoutingSessionInfo.Builder#build())`()` Builds a routing session info.                                                                                                                                                                                                                                                                                                                                                                       |
| [RoutingSessionInfo.Builder](https://developer.android.com/reference/kotlin/android/media/RoutingSessionInfo.Builder#) | [clearDeselectableRoutes](https://developer.android.com/reference/kotlin/android/media/RoutingSessionInfo.Builder#clearDeselectableRoutes())`()` Clears the deselectable routes.                                                                                                                                                                                                                                                                                                                                  |
| [RoutingSessionInfo.Builder](https://developer.android.com/reference/kotlin/android/media/RoutingSessionInfo.Builder#) | [clearSelectableRoutes](https://developer.android.com/reference/kotlin/android/media/RoutingSessionInfo.Builder#clearSelectableRoutes())`()` Clears the selectable routes.                                                                                                                                                                                                                                                                                                                                        |
| [RoutingSessionInfo.Builder](https://developer.android.com/reference/kotlin/android/media/RoutingSessionInfo.Builder#) | [clearSelectedRoutes](https://developer.android.com/reference/kotlin/android/media/RoutingSessionInfo.Builder#clearSelectedRoutes())`()` Clears the selected routes.                                                                                                                                                                                                                                                                                                                                              |
| [RoutingSessionInfo.Builder](https://developer.android.com/reference/kotlin/android/media/RoutingSessionInfo.Builder#) | [clearTransferableRoutes](https://developer.android.com/reference/kotlin/android/media/RoutingSessionInfo.Builder#clearTransferableRoutes())`()` Clears the transferable routes.                                                                                                                                                                                                                                                                                                                                  |
| [RoutingSessionInfo.Builder](https://developer.android.com/reference/kotlin/android/media/RoutingSessionInfo.Builder#) | [removeDeselectableRoute](https://developer.android.com/reference/kotlin/android/media/RoutingSessionInfo.Builder#removeDeselectableRoute(kotlin.String))`(`routeId:` `[String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)`)` Removes a route from the deselectable routes.                                                                                                                                                                                                          |
| [RoutingSessionInfo.Builder](https://developer.android.com/reference/kotlin/android/media/RoutingSessionInfo.Builder#) | [removeSelectableRoute](https://developer.android.com/reference/kotlin/android/media/RoutingSessionInfo.Builder#removeSelectableRoute(kotlin.String))`(`routeId:` `[String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)`)` Removes a route from the selectable routes.                                                                                                                                                                                                                |
| [RoutingSessionInfo.Builder](https://developer.android.com/reference/kotlin/android/media/RoutingSessionInfo.Builder#) | [removeSelectedRoute](https://developer.android.com/reference/kotlin/android/media/RoutingSessionInfo.Builder#removeSelectedRoute(kotlin.String))`(`routeId:` `[String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)`)` Removes a route from the selected routes.                                                                                                                                                                                                                      |
| [RoutingSessionInfo.Builder](https://developer.android.com/reference/kotlin/android/media/RoutingSessionInfo.Builder#) | [removeTransferableRoute](https://developer.android.com/reference/kotlin/android/media/RoutingSessionInfo.Builder#removeTransferableRoute(kotlin.String))`(`routeId:` `[String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)`)` Removes a route from the transferable routes.                                                                                                                                                                                                          |
| [RoutingSessionInfo.Builder](https://developer.android.com/reference/kotlin/android/media/RoutingSessionInfo.Builder#) | [setControlHints](https://developer.android.com/reference/kotlin/android/media/RoutingSessionInfo.Builder#setControlHints(android.os.Bundle))`(`controlHints:` `[Bundle](https://developer.android.com/reference/kotlin/android/os/Bundle.html#)?`)` Sets control hints.                                                                                                                                                                                                                                          |
| [RoutingSessionInfo.Builder](https://developer.android.com/reference/kotlin/android/media/RoutingSessionInfo.Builder#) | [setName](https://developer.android.com/reference/kotlin/android/media/RoutingSessionInfo.Builder#setName(kotlin.CharSequence))`(`name:` `[CharSequence](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-char-sequence/index.html)?`)` Sets the user-visible name of the session.                                                                                                                                                                                                                            |
| [RoutingSessionInfo.Builder](https://developer.android.com/reference/kotlin/android/media/RoutingSessionInfo.Builder#) | [setTransferInitiator](https://developer.android.com/reference/kotlin/android/media/RoutingSessionInfo.Builder#setTransferInitiator(android.os.UserHandle,%20kotlin.String))`(`transferInitiatorUserHandle:` `[UserHandle](https://developer.android.com/reference/kotlin/android/os/UserHandle.html#)?`, `transferInitiatorPackageName:` `[String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)?`)` Sets the user handle and package name of the process that initiated the transfer. |
| [RoutingSessionInfo.Builder](https://developer.android.com/reference/kotlin/android/media/RoutingSessionInfo.Builder#) | [setTransferReason](https://developer.android.com/reference/kotlin/android/media/RoutingSessionInfo.Builder#setTransferReason(kotlin.Int))`(`transferReason:` `[Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)`)` Sets transfer reason for the current session.                                                                                                                                                                                                                        |
| [RoutingSessionInfo.Builder](https://developer.android.com/reference/kotlin/android/media/RoutingSessionInfo.Builder#) | [setVolume](https://developer.android.com/reference/kotlin/android/media/RoutingSessionInfo.Builder#setVolume(kotlin.Int))`(`volume:` `[Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)`)` Sets the session's current volume, or 0 if unknown.                                                                                                                                                                                                                                          |
| [RoutingSessionInfo.Builder](https://developer.android.com/reference/kotlin/android/media/RoutingSessionInfo.Builder#) | [setVolumeHandling](https://developer.android.com/reference/kotlin/android/media/RoutingSessionInfo.Builder#setVolumeHandling(kotlin.Int))`(`volumeHandling:` `[Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)`)` Sets the session's volume handling.                                                                                                                                                                                                                                  |
| [RoutingSessionInfo.Builder](https://developer.android.com/reference/kotlin/android/media/RoutingSessionInfo.Builder#) | [setVolumeMax](https://developer.android.com/reference/kotlin/android/media/RoutingSessionInfo.Builder#setVolumeMax(kotlin.Int))`(`volumeMax:` `[Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)`)` Sets the session's maximum volume, or 0 if unknown.                                                                                                                                                                                                                                 |

## Public constructors

### Builder

Added in[API level 30](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  

```
Builder(sessionInfo: RoutingSessionInfo)
```

Constructor for builder to create[RoutingSessionInfo](https://developer.android.com/reference/kotlin/android/media/RoutingSessionInfo)with existing[RoutingSessionInfo](https://developer.android.com/reference/kotlin/android/media/RoutingSessionInfo)instance.

|                                                                                        Parameters                                                                                         ||
|---------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `sessionInfo` | [RoutingSessionInfo](https://developer.android.com/reference/kotlin/android/media/RoutingSessionInfo):the existing instance to copy data from. This value cannot be`null`. |

### Builder

Added in[API level 30](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  

```
Builder(
    originalId: String, 
    clientPackageName: String)
```

Constructor for builder to create[RoutingSessionInfo](https://developer.android.com/reference/kotlin/android/media/RoutingSessionInfo).

In order to ensure ID uniqueness in[MediaRouter2](https://developer.android.com/reference/kotlin/android/media/MediaRouter2)side, the value of[android.media.RoutingSessionInfo#getId()](https://developer.android.com/reference/kotlin/android/media/RoutingSessionInfo#getId())can be different from what was set in[MediaRoute2ProviderService](https://developer.android.com/reference/kotlin/android/media/MediaRoute2ProviderService).

|                                                                                                                 Parameters                                                                                                                 ||
|---------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `originalId`        | [String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html):ID of the session. Must not be empty. This value cannot be`null`.                                                                    |
| `clientPackageName` | [String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html):package name of the client app which uses this session. If is is unknown, then just use an empty string. This value cannot be`null`. |

**See Also**

- [android.media.MediaRoute2Info#getId()](https://developer.android.com/reference/kotlin/android/media/MediaRoute2Info#getId())

## Public methods

### addDeselectableRoute

Added in[API level 30](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  

```
fun addDeselectableRoute(routeId: String): RoutingSessionInfo.Builder
```

Adds a route to the deselectable routes. The`routeId`must not be empty.

|                                                       Parameters                                                        ||
|-----------|--------------------------------------------------------------------------------------------------------------|
| `routeId` | [String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html):This value cannot be`null`. |

|                                                                       Return                                                                        ||
|------------------------------------------------------------------------------------------------------------------------|-----------------------------|
| [RoutingSessionInfo.Builder](https://developer.android.com/reference/kotlin/android/media/RoutingSessionInfo.Builder#) | This value cannot be`null`. |

### addSelectableRoute

Added in[API level 30](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  

```
fun addSelectableRoute(routeId: String): RoutingSessionInfo.Builder
```

Adds a route to the selectable routes. The`routeId`must not be empty.

|                                                       Parameters                                                        ||
|-----------|--------------------------------------------------------------------------------------------------------------|
| `routeId` | [String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html):This value cannot be`null`. |

|                                                                       Return                                                                        ||
|------------------------------------------------------------------------------------------------------------------------|-----------------------------|
| [RoutingSessionInfo.Builder](https://developer.android.com/reference/kotlin/android/media/RoutingSessionInfo.Builder#) | This value cannot be`null`. |

### addSelectedRoute

Added in[API level 30](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  

```
fun addSelectedRoute(routeId: String): RoutingSessionInfo.Builder
```

Adds a route to the selected routes. The`routeId`must not be empty.

|                                                       Parameters                                                        ||
|-----------|--------------------------------------------------------------------------------------------------------------|
| `routeId` | [String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html):This value cannot be`null`. |

|                                                                       Return                                                                        ||
|------------------------------------------------------------------------------------------------------------------------|-----------------------------|
| [RoutingSessionInfo.Builder](https://developer.android.com/reference/kotlin/android/media/RoutingSessionInfo.Builder#) | This value cannot be`null`. |

### addTransferableRoute

Added in[API level 30](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  

```
fun addTransferableRoute(routeId: String): RoutingSessionInfo.Builder
```

Adds a route to the transferable routes. The`routeId`must not be empty.

|                                                       Parameters                                                        ||
|-----------|--------------------------------------------------------------------------------------------------------------|
| `routeId` | [String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html):This value cannot be`null`. |

|                                                                       Return                                                                        ||
|------------------------------------------------------------------------------------------------------------------------|-----------------------------|
| [RoutingSessionInfo.Builder](https://developer.android.com/reference/kotlin/android/media/RoutingSessionInfo.Builder#) | This value cannot be`null`. |

### build

Added in[API level 30](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  

```
fun build(): RoutingSessionInfo
```

Builds a routing session info.

|                                                               Return                                                               ||
|-------------------------------------------------------------------------------------------------------|-----------------------------|
| [RoutingSessionInfo](https://developer.android.com/reference/kotlin/android/media/RoutingSessionInfo) | This value cannot be`null`. |

|                               Exceptions                               ||
|--------------------------------------|----------------------------------|
| `java.lang.IllegalArgumentException` | if no selected routes are added. |

### clearDeselectableRoutes

Added in[API level 30](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  

```
fun clearDeselectableRoutes(): RoutingSessionInfo.Builder
```

Clears the deselectable routes.

|                                                                       Return                                                                        ||
|------------------------------------------------------------------------------------------------------------------------|-----------------------------|
| [RoutingSessionInfo.Builder](https://developer.android.com/reference/kotlin/android/media/RoutingSessionInfo.Builder#) | This value cannot be`null`. |

### clearSelectableRoutes

Added in[API level 30](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  

```
fun clearSelectableRoutes(): RoutingSessionInfo.Builder
```

Clears the selectable routes.

|                                                                       Return                                                                        ||
|------------------------------------------------------------------------------------------------------------------------|-----------------------------|
| [RoutingSessionInfo.Builder](https://developer.android.com/reference/kotlin/android/media/RoutingSessionInfo.Builder#) | This value cannot be`null`. |

### clearSelectedRoutes

Added in[API level 30](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  

```
fun clearSelectedRoutes(): RoutingSessionInfo.Builder
```

Clears the selected routes.

|                                                                       Return                                                                        ||
|------------------------------------------------------------------------------------------------------------------------|-----------------------------|
| [RoutingSessionInfo.Builder](https://developer.android.com/reference/kotlin/android/media/RoutingSessionInfo.Builder#) | This value cannot be`null`. |

### clearTransferableRoutes

Added in[API level 30](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  

```
fun clearTransferableRoutes(): RoutingSessionInfo.Builder
```

Clears the transferable routes.

|                                                                       Return                                                                        ||
|------------------------------------------------------------------------------------------------------------------------|-----------------------------|
| [RoutingSessionInfo.Builder](https://developer.android.com/reference/kotlin/android/media/RoutingSessionInfo.Builder#) | This value cannot be`null`. |

### removeDeselectableRoute

Added in[API level 30](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  

```
fun removeDeselectableRoute(routeId: String): RoutingSessionInfo.Builder
```

Removes a route from the deselectable routes. The`routeId`must not be empty.

|                                                       Parameters                                                        ||
|-----------|--------------------------------------------------------------------------------------------------------------|
| `routeId` | [String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html):This value cannot be`null`. |

|                                                                       Return                                                                        ||
|------------------------------------------------------------------------------------------------------------------------|-----------------------------|
| [RoutingSessionInfo.Builder](https://developer.android.com/reference/kotlin/android/media/RoutingSessionInfo.Builder#) | This value cannot be`null`. |

### removeSelectableRoute

Added in[API level 30](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  

```
fun removeSelectableRoute(routeId: String): RoutingSessionInfo.Builder
```

Removes a route from the selectable routes. The`routeId`must not be empty.

|                                                       Parameters                                                        ||
|-----------|--------------------------------------------------------------------------------------------------------------|
| `routeId` | [String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html):This value cannot be`null`. |

|                                                                       Return                                                                        ||
|------------------------------------------------------------------------------------------------------------------------|-----------------------------|
| [RoutingSessionInfo.Builder](https://developer.android.com/reference/kotlin/android/media/RoutingSessionInfo.Builder#) | This value cannot be`null`. |

### removeSelectedRoute

Added in[API level 30](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  

```
fun removeSelectedRoute(routeId: String): RoutingSessionInfo.Builder
```

Removes a route from the selected routes. The`routeId`must not be empty.

|                                                       Parameters                                                        ||
|-----------|--------------------------------------------------------------------------------------------------------------|
| `routeId` | [String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html):This value cannot be`null`. |

|                                                                       Return                                                                        ||
|------------------------------------------------------------------------------------------------------------------------|-----------------------------|
| [RoutingSessionInfo.Builder](https://developer.android.com/reference/kotlin/android/media/RoutingSessionInfo.Builder#) | This value cannot be`null`. |

### removeTransferableRoute

Added in[API level 30](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  

```
fun removeTransferableRoute(routeId: String): RoutingSessionInfo.Builder
```

Removes a route from the transferable routes. The`routeId`must not be empty.

|                                                       Parameters                                                        ||
|-----------|--------------------------------------------------------------------------------------------------------------|
| `routeId` | [String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html):This value cannot be`null`. |

|                                                                       Return                                                                        ||
|------------------------------------------------------------------------------------------------------------------------|-----------------------------|
| [RoutingSessionInfo.Builder](https://developer.android.com/reference/kotlin/android/media/RoutingSessionInfo.Builder#) | This value cannot be`null`. |

### setControlHints

Added in[API level 30](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  

```
fun setControlHints(controlHints: Bundle?): RoutingSessionInfo.Builder
```

Sets control hints.

|                                                         Parameters                                                         ||
|----------------|------------------------------------------------------------------------------------------------------------|
| `controlHints` | [Bundle](https://developer.android.com/reference/kotlin/android/os/Bundle.html#)?:This value may be`null`. |

|                                                                       Return                                                                        ||
|------------------------------------------------------------------------------------------------------------------------|-----------------------------|
| [RoutingSessionInfo.Builder](https://developer.android.com/reference/kotlin/android/media/RoutingSessionInfo.Builder#) | This value cannot be`null`. |

### setName

Added in[API level 30](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  

```
fun setName(name: CharSequence?): RoutingSessionInfo.Builder
```

Sets the user-visible name of the session.

|                                                           Parameters                                                            ||
|--------|-------------------------------------------------------------------------------------------------------------------------|
| `name` | [CharSequence](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-char-sequence/index.html)?:This value may be`null`. |

|                                                                       Return                                                                        ||
|------------------------------------------------------------------------------------------------------------------------|-----------------------------|
| [RoutingSessionInfo.Builder](https://developer.android.com/reference/kotlin/android/media/RoutingSessionInfo.Builder#) | This value cannot be`null`. |

### setTransferInitiator

Added in[API level 35](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  

```
fun setTransferInitiator(
    transferInitiatorUserHandle: UserHandle?, 
    transferInitiatorPackageName: String?
): RoutingSessionInfo.Builder
```

Sets the user handle and package name of the process that initiated the transfer.

By default the transfer initiation user handle and package name are set to`null`.

|                                                                     Parameters                                                                     ||
|--------------------------------|--------------------------------------------------------------------------------------------------------------------|
| `transferInitiatorUserHandle`  | [UserHandle](https://developer.android.com/reference/kotlin/android/os/UserHandle.html#)?:This value may be`null`. |
| `transferInitiatorPackageName` | [String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)?:This value may be`null`.         |

### setTransferReason

Added in[API level 35](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  

```
fun setTransferReason(transferReason: Int): RoutingSessionInfo.Builder
```

Sets transfer reason for the current session.

By default the transfer reason is set to[android.media.RoutingSessionInfo#TRANSFER_REASON_FALLBACK](https://developer.android.com/reference/kotlin/android/media/RoutingSessionInfo#TRANSFER_REASON_FALLBACK:kotlin.Int).

|                                                                                                                                                                                                                                                                                                                          Parameters                                                                                                                                                                                                                                                                                                                          ||
|------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `transferReason` | [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html):Value is[android.media.RoutingSessionInfo#TRANSFER_REASON_FALLBACK](https://developer.android.com/reference/kotlin/android/media/RoutingSessionInfo#TRANSFER_REASON_FALLBACK:kotlin.Int),[android.media.RoutingSessionInfo#TRANSFER_REASON_SYSTEM_REQUEST](https://developer.android.com/reference/kotlin/android/media/RoutingSessionInfo#TRANSFER_REASON_SYSTEM_REQUEST:kotlin.Int), or[android.media.RoutingSessionInfo#TRANSFER_REASON_APP](https://developer.android.com/reference/kotlin/android/media/RoutingSessionInfo#TRANSFER_REASON_APP:kotlin.Int) |

|                                                                       Return                                                                        ||
|------------------------------------------------------------------------------------------------------------------------|-----------------------------|
| [RoutingSessionInfo.Builder](https://developer.android.com/reference/kotlin/android/media/RoutingSessionInfo.Builder#) | This value cannot be`null`. |

### setVolume

Added in[API level 30](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  

```
fun setVolume(volume: Int): RoutingSessionInfo.Builder
```

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

|                                                                       Return                                                                        ||
|------------------------------------------------------------------------------------------------------------------------|-----------------------------|
| [RoutingSessionInfo.Builder](https://developer.android.com/reference/kotlin/android/media/RoutingSessionInfo.Builder#) | This value cannot be`null`. |

### setVolumeHandling

Added in[API level 30](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  

```
fun setVolumeHandling(volumeHandling: Int): RoutingSessionInfo.Builder
```

Sets the session's volume handling.[MediaRoute2Info.PLAYBACK_VOLUME_FIXED](https://developer.android.com/reference/kotlin/android/media/MediaRoute2Info#PLAYBACK_VOLUME_FIXED:kotlin.Int)or[MediaRoute2Info.PLAYBACK_VOLUME_VARIABLE](https://developer.android.com/reference/kotlin/android/media/MediaRoute2Info#PLAYBACK_VOLUME_VARIABLE:kotlin.Int).

|                                                                                                                                                                                                                       Parameters                                                                                                                                                                                                                        ||
|------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `volumeHandling` | [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html):Value is[android.media.MediaRoute2Info#PLAYBACK_VOLUME_FIXED](https://developer.android.com/reference/kotlin/android/media/MediaRoute2Info#PLAYBACK_VOLUME_FIXED:kotlin.Int), or[android.media.MediaRoute2Info#PLAYBACK_VOLUME_VARIABLE](https://developer.android.com/reference/kotlin/android/media/MediaRoute2Info#PLAYBACK_VOLUME_VARIABLE:kotlin.Int) |

|                                                                       Return                                                                        ||
|------------------------------------------------------------------------------------------------------------------------|-----------------------------|
| [RoutingSessionInfo.Builder](https://developer.android.com/reference/kotlin/android/media/RoutingSessionInfo.Builder#) | This value cannot be`null`. |

### setVolumeMax

Added in[API level 30](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  

```
fun setVolumeMax(volumeMax: Int): RoutingSessionInfo.Builder
```

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

|                                                                       Return                                                                        ||
|------------------------------------------------------------------------------------------------------------------------|-----------------------------|
| [RoutingSessionInfo.Builder](https://developer.android.com/reference/kotlin/android/media/RoutingSessionInfo.Builder#) | This value cannot be`null`. |