Stay organized with collections
Save and categorize content based on your preferences.
Builder
class Builder
Builder for RouteDiscoveryPreference
.
Summary
Public constructors
Public methods
fun setShouldPerformActiveScan(activeScan: Boolean): RouteDiscoveryPreference.Builder
Sets if active scanning should be performed.
Since active scanning uses more system resources, set this as true
only when it's necessary.
Content and code samples on this page are subject to the licenses described in the Content License. Java and OpenJDK are trademarks or registered trademarks of Oracle and/or its affiliates.
Last updated 2025-02-10 UTC.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-02-10 UTC."],[],[],null,["# RouteDiscoveryPreference.Builder\n\nAdded in [API level 30](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)\n\nBuilder\n=======\n\n*** ** * ** ***\n\nKotlin \\|[Java](/reference/android/media/RouteDiscoveryPreference.Builder \"View this page in Java\") \n\n```\nclass Builder\n```\n\n|---|-----------------------------------------------------|\n| [kotlin.Any](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-any/index.html) ||\n| ↳ | [android.media.RouteDiscoveryPreference.Builder](#) |\n\nBuilder for [RouteDiscoveryPreference](/reference/kotlin/android/media/RouteDiscoveryPreference).\n\nSummary\n-------\n\n| Public constructors ||\n|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|---|\n| [Builder](#Builder(android.media.RouteDiscoveryPreference))`(`preference:` `[RouteDiscoveryPreference](/reference/kotlin/android/media/RouteDiscoveryPreference)`)` \u003cbr /\u003e |\n| [Builder](#Builder(kotlin.collections.MutableList,%20kotlin.Boolean))`(`preferredFeatures:` `[MutableList](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.collections/-mutable-list/index.html)\u003c[String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)!\u003e`, `activeScan:` `[Boolean](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html)`)` \u003cbr /\u003e |\n\n| Public methods ||\n|--------------------------------------------------------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| [RouteDiscoveryPreference](/reference/kotlin/android/media/RouteDiscoveryPreference) | [build](#build())`()` Builds the [RouteDiscoveryPreference](/reference/kotlin/android/media/RouteDiscoveryPreference). |\n| [RouteDiscoveryPreference.Builder](#) | [setPreferredFeatures](#setPreferredFeatures(kotlin.collections.MutableList))`(`preferredFeatures:` `[MutableList](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.collections/-mutable-list/index.html)\u003c[String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)!\u003e`)` Sets preferred route features to discover. |\n| [RouteDiscoveryPreference.Builder](#) | [setShouldPerformActiveScan](#setShouldPerformActiveScan(kotlin.Boolean))`(`activeScan:` `[Boolean](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html)`)` Sets if active scanning should be performed. |\n\nPublic constructors\n-------------------\n\n### Builder\n\nAdded in [API level 30](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels) \n\n```\nBuilder(preference: RouteDiscoveryPreference)\n```\n\n| Parameters ||\n|--------------|--------------------------------------------------------------------------------------------------------------------|\n| `preference` | [RouteDiscoveryPreference](/reference/kotlin/android/media/RouteDiscoveryPreference): This value cannot be `null`. |\n\n### Builder\n\nAdded in [API level 30](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels) \n\n```\nBuilder(\n preferredFeatures: MutableList\u003cString!\u003e, \n activeScan: Boolean)\n```\n\n| Parameters ||\n|---------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| `preferredFeatures` | [MutableList](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.collections/-mutable-list/index.html)\\\u003c[String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)!\\\u003e: This value cannot be `null`. |\n\nPublic methods\n--------------\n\n### build\n\nAdded in [API level 30](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels) \n\n```\nfun build(): RouteDiscoveryPreference\n```\n\nBuilds the [RouteDiscoveryPreference](/reference/kotlin/android/media/RouteDiscoveryPreference).\n\n| Return ||\n|--------------------------------------------------------------------------------------|------------------------------|\n| [RouteDiscoveryPreference](/reference/kotlin/android/media/RouteDiscoveryPreference) | This value cannot be `null`. |\n\n### setPreferredFeatures\n\nAdded in [API level 30](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels) \n\n```\nfun setPreferredFeatures(preferredFeatures: MutableList\u003cString!\u003e): RouteDiscoveryPreference.Builder\n```\n\nSets preferred route features to discover.\n\n| Parameters ||\n|---------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| `preferredFeatures` | [MutableList](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.collections/-mutable-list/index.html)\\\u003c[String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)!\\\u003e: features of routes that media router would like to discover. May include predefined features such as [MediaRoute2Info.FEATURE_LIVE_AUDIO](/reference/kotlin/android/media/MediaRoute2Info#FEATURE_LIVE_AUDIO:kotlin.String), [MediaRoute2Info.FEATURE_LIVE_VIDEO](/reference/kotlin/android/media/MediaRoute2Info#FEATURE_LIVE_VIDEO:kotlin.String), or [MediaRoute2Info.FEATURE_REMOTE_PLAYBACK](/reference/kotlin/android/media/MediaRoute2Info#FEATURE_REMOTE_PLAYBACK:kotlin.String) or custom features defined by a provider. This value cannot be `null`. |\n\n| Return ||\n|---------------------------------------|------------------------------|\n| [RouteDiscoveryPreference.Builder](#) | This value cannot be `null`. |\n\n### setShouldPerformActiveScan\n\nAdded in [API level 30](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels) \n\n```\nfun setShouldPerformActiveScan(activeScan: Boolean): RouteDiscoveryPreference.Builder\n```\n\nSets if active scanning should be performed.\n\nSince active scanning uses more system resources, set this as `true` only when it's necessary.\n\n| Return ||\n|---------------------------------------|------------------------------|\n| [RouteDiscoveryPreference.Builder](#) | This value cannot be `null`. |"]]