# MediaRouteDiscoveryRequest

Artifact: [androidx.mediarouter:mediarouter](https://developer.android.com/jetpack/androidx/releases/mediarouter) [View Source](https://cs.android.com/search?q=file:androidx/mediarouter/media/MediaRouteDiscoveryRequest.java+class:androidx.mediarouter.media.MediaRouteDiscoveryRequest) Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/mediarouter#1.1.0)

*** ** * ** ***


```
class MediaRouteDiscoveryRequest
```

<br />

*** ** * ** ***

Describes the kinds of routes that the media router would like to discover and whether to perform active scanning.

This object is immutable once created.

## Summary

| ### Public constructors |
|---|
| `https://developer.android.com/reference/kotlin/androidx/mediarouter/media/MediaRouteDiscoveryRequest#MediaRouteDiscoveryRequest(androidx.mediarouter.media.MediaRouteSelector,boolean)( selector: https://developer.android.com/reference/kotlin/androidx/mediarouter/media/MediaRouteSelector, activeScan: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html )` Creates a media route discovery request. |

| ### Public functions |
|---|---|
| `https://developer.android.com/reference/android/os/Bundle.html` | `https://developer.android.com/reference/kotlin/androidx/mediarouter/media/MediaRouteDiscoveryRequest#asBundle()()` Converts this object to a bundle for serialization. |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | `https://developer.android.com/reference/kotlin/androidx/mediarouter/media/MediaRouteDiscoveryRequest#equals(java.lang.Object)(o: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-any/index.html!)` |
| `java-static https://developer.android.com/reference/kotlin/androidx/mediarouter/media/MediaRouteDiscoveryRequest?` | `https://developer.android.com/reference/kotlin/androidx/mediarouter/media/MediaRouteDiscoveryRequest#fromBundle(android.os.Bundle)(bundle: https://developer.android.com/reference/android/os/Bundle.html?)` Creates an instance from a bundle. |
| `https://developer.android.com/reference/kotlin/androidx/mediarouter/media/MediaRouteSelector` | `https://developer.android.com/reference/kotlin/androidx/mediarouter/media/MediaRouteDiscoveryRequest#getSelector()()` Gets the route selector that specifies the kinds of routes to discover. |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | `https://developer.android.com/reference/kotlin/androidx/mediarouter/media/MediaRouteDiscoveryRequest#hashCode()()` |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | `https://developer.android.com/reference/kotlin/androidx/mediarouter/media/MediaRouteDiscoveryRequest#isActiveScan()()` Returns true if active scanning should be performed. |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | `https://developer.android.com/reference/kotlin/androidx/mediarouter/media/MediaRouteDiscoveryRequest#isValid()()` Returns true if the discovery request has all of the required fields. |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | `https://developer.android.com/reference/kotlin/androidx/mediarouter/media/MediaRouteDiscoveryRequest#shouldScanWithScreenOff()()` Returns true if scanning should be performed even when the screen is off. |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html` | `https://developer.android.com/reference/kotlin/androidx/mediarouter/media/MediaRouteDiscoveryRequest#toString()()` |

## Public constructors

### MediaRouteDiscoveryRequest

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/mediarouter#1.1.0)

```
MediaRouteDiscoveryRequest(
    selector: MediaRouteSelector,
    activeScan: Boolean
)
```

Creates a media route discovery request.

| Parameters |
|---|---|
| `selector: https://developer.android.com/reference/kotlin/androidx/mediarouter/media/MediaRouteSelector` | The route selector that specifies the kinds of routes to discover. |
| `activeScan: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | True if active scanning should be performed. |

## Public functions

### asBundle

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/mediarouter#1.1.0)

```
fun asBundle(): Bundle
```

Converts this object to a bundle for serialization.

| Returns |
|---|---|
| `https://developer.android.com/reference/android/os/Bundle.html` | The contents of the object represented as a bundle. |

### equals

```
fun equals(o: Any!): Boolean
```

### fromBundle

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/mediarouter#1.1.0)

```
java-static fun fromBundle(bundle: Bundle?): MediaRouteDiscoveryRequest?
```

Creates an instance from a bundle.

| Parameters |
|---|---|
| `bundle: https://developer.android.com/reference/android/os/Bundle.html?` | The bundle, or null if none. |

| Returns |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/mediarouter/media/MediaRouteDiscoveryRequest?` | The new instance, or null if the bundle was null. |

### getSelector

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/mediarouter#1.1.0)

```
fun getSelector(): MediaRouteSelector
```

Gets the route selector that specifies the kinds of routes to discover.

### hashCode

```
fun hashCode(): Int
```

### isActiveScan

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/mediarouter#1.1.0)

```
fun isActiveScan(): Boolean
```

Returns true if active scanning should be performed.

| See also |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/mediarouter/media/MediaRouter#CALLBACK_FLAG_PERFORM_ACTIVE_SCAN()` |   |

### isValid

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/mediarouter#1.1.0)

```
fun isValid(): Boolean
```

Returns true if the discovery request has all of the required fields.

### shouldScanWithScreenOff

Added in [1.9.0-rc01](https://developer.android.com/jetpack/androidx/releases/mediarouter#1.9.0-rc01)

```
fun shouldScanWithScreenOff(): Boolean
```

Returns true if scanning should be performed even when the screen is off. This can only be true if `https://developer.android.com/reference/kotlin/androidx/mediarouter/media/MediaRouteDiscoveryRequest#isActiveScan()` is true.

### toString

```
fun toString(): String
```