Stay organized with collections
Save and categorize content based on your preferences.
Builder
class Builder
Builder for WifiP2pUsdBasedServiceDiscoveryConfig
.
Summary
Public constructors |
Constructs a Builder with default values.
|
Public constructors
Builder
Builder()
Constructs a Builder with default values.
Public methods
setBand
fun setBand(band: Int): WifiP2pUsdBasedServiceDiscoveryConfig.Builder
Specifies the band requested for service discovery. The band should be one of the following band constants defined in ScanResult#WIFI_BAND_24_GHZ
, ScanResult#WIFI_BAND_5_GHZ
or ScanResult#WIFI_BAND_6_GHZ
setBand(int)
and setFrequenciesMhz(int[])
are mutually exclusive. Setting operating band and frequency both is invalid.
Optional. ScanResult#UNSPECIFIED
by default.
Parameters |
band |
Int: The requested band. |
Exceptions |
java.lang.IllegalArgumentException |
- if the band specified is not one among the list of bands mentioned above. |
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-03-13 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-03-13 UTC."],[],[],null,["# WifiP2pUsdBasedServiceDiscoveryConfig.Builder\n\nAdded in [API level 36](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)\n\nBuilder\n=======\n\n*** ** * ** ***\n\nKotlin \\|[Java](/reference/android/net/wifi/p2p/WifiP2pUsdBasedServiceDiscoveryConfig.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.net.wifi.p2p.WifiP2pUsdBasedServiceDiscoveryConfig.Builder](#) |\n\nBuilder for [WifiP2pUsdBasedServiceDiscoveryConfig](/reference/kotlin/android/net/wifi/p2p/WifiP2pUsdBasedServiceDiscoveryConfig).\n\nSummary\n-------\n\n| Public constructors ||\n|---------------------------------------------------------------------|---|\n| [Builder](#Builder())`()` Constructs a Builder with default values. |\n\n| Public methods ||\n|-----------------------------------------------------------------------------------------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| [WifiP2pUsdBasedServiceDiscoveryConfig](/reference/kotlin/android/net/wifi/p2p/WifiP2pUsdBasedServiceDiscoveryConfig) | [build](#build())`()` Build [WifiP2pUsdBasedServiceDiscoveryConfig](/reference/kotlin/android/net/wifi/p2p/WifiP2pUsdBasedServiceDiscoveryConfig) given the current requests made on the builder. |\n| [WifiP2pUsdBasedServiceDiscoveryConfig.Builder](#) | [setBand](#setBand(kotlin.Int))`(`band:` `[Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)`)` Specifies the band requested for service discovery. |\n| [WifiP2pUsdBasedServiceDiscoveryConfig.Builder](#) | [setFrequenciesMhz](#setFrequenciesMhz(kotlin.IntArray))`(`frequenciesMhz:` `[IntArray](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int-array/index.html)`)` Set the frequencies requested for service discovery. |\n\nPublic constructors\n-------------------\n\n### Builder\n\nAdded in [API level 36](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels) \n\n```\nBuilder()\n```\n\nConstructs a Builder with default values.\n\nPublic methods\n--------------\n\n### build\n\nAdded in [API level 36](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels) \n\n```\nfun build(): WifiP2pUsdBasedServiceDiscoveryConfig\n```\n\nBuild [WifiP2pUsdBasedServiceDiscoveryConfig](/reference/kotlin/android/net/wifi/p2p/WifiP2pUsdBasedServiceDiscoveryConfig) given the current requests made on the builder.\n\n| Return ||\n|-----------------------------------------------------------------------------------------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| [WifiP2pUsdBasedServiceDiscoveryConfig](/reference/kotlin/android/net/wifi/p2p/WifiP2pUsdBasedServiceDiscoveryConfig) | [WifiP2pUsdBasedServiceDiscoveryConfig](/reference/kotlin/android/net/wifi/p2p/WifiP2pUsdBasedServiceDiscoveryConfig) constructed based on builder method calls. This value cannot be `null`. |\n\n### setBand\n\nAdded in [API level 36](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels) \n\n```\nfun setBand(band: Int): WifiP2pUsdBasedServiceDiscoveryConfig.Builder\n```\n\nSpecifies the band requested for service discovery. The band should be one of the following band constants defined in `ScanResult#WIFI_BAND_24_GHZ`, `ScanResult#WIFI_BAND_5_GHZ` or `ScanResult#WIFI_BAND_6_GHZ`\n\n[setBand(int)](#setBand(kotlin.Int)) and [setFrequenciesMhz(int[])](#setFrequenciesMhz(kotlin.IntArray)) are mutually exclusive. Setting operating band and frequency both is invalid.\n\nOptional. `ScanResult#UNSPECIFIED` by default.\n\n| Parameters ||\n|--------|-------------------------------------------------------------------------------------------------|\n| `band` | [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html): The requested band. |\n\n| Return ||\n|----------------------------------------------------|-------------------------------------------------------------------------------------------------|\n| [WifiP2pUsdBasedServiceDiscoveryConfig.Builder](#) | Instance of [Builder](#) to enable chaining of the builder method. This value cannot be `null`. |\n\n| Exceptions ||\n|--------------------------------------|-----------------------------------------------------------------------------|\n| `java.lang.IllegalArgumentException` | - if the band specified is not one among the list of bands mentioned above. |\n\n### setFrequenciesMhz\n\nAdded in [API level 36](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels) \n\n```\nfun setFrequenciesMhz(frequenciesMhz: IntArray): WifiP2pUsdBasedServiceDiscoveryConfig.Builder\n```\n\nSet the frequencies requested for service discovery.\n\n[setBand(int)](#setBand(kotlin.Int)) and [setFrequenciesMhz(int[])](#setFrequenciesMhz(kotlin.IntArray)) are mutually exclusive. Setting band and frequencies both is invalid.\n\nOptional. 2437 by default.\n\n| Parameters ||\n|------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| `frequenciesMhz` | [IntArray](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int-array/index.html): Frequencies in MHz to scan for services. This value cannot be an empty array of frequencies. This value cannot be `null`. |\n\n| Return ||\n|----------------------------------------------------|-------------------------------------------------------------------------------------------------|\n| [WifiP2pUsdBasedServiceDiscoveryConfig.Builder](#) | Instance of [Builder](#) to enable chaining of the builder method. This value cannot be `null`. |"]]