Stay organized with collections
Save and categorize content based on your preferences.
Builder
class Builder
Builder used to build WifiP2pUsdBasedServiceConfig
objects for USD based service discovery and advertisement.
Summary
Public constructors |
Constructor for Builder .
|
Public constructors
Builder
Builder(serviceName: String)
Constructor for Builder
.
Parameters |
serviceName |
String: The service name defining the service. The maximum allowed length of the service name is 100 characters. This value cannot be null . |
Public methods
setServiceProtocolType
fun setServiceProtocolType(serviceProtocolType: Int): WifiP2pUsdBasedServiceConfig.Builder
Specify the service discovery protocol type.
Optional. SERVICE_PROTOCOL_TYPE_GENERIC
by default.
Parameters |
serviceProtocolType |
Int: One of the SERVICE_PROTOCOL_TYPE_* or a non-negative number set by the service layer. Value is between 0 and 255 inclusive |
setServiceSpecificInfo
fun setServiceSpecificInfo(serviceSpecificInfo: ByteArray?): WifiP2pUsdBasedServiceConfig.Builder
Specify service specific information content determined by the application.
Optional. Empty by default.
Parameters |
serviceSpecificInfo |
ByteArray?: A byte-array of service-specific information available to the application to send additional information. Users must call getMaxAllowedServiceSpecificInfoLength() method to know maximum allowed legth. This value may be null . |
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,["# WifiP2pUsdBasedServiceConfig.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/nsd/WifiP2pUsdBasedServiceConfig.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.nsd.WifiP2pUsdBasedServiceConfig.Builder](#) |\n\nBuilder used to build [WifiP2pUsdBasedServiceConfig](/reference/kotlin/android/net/wifi/p2p/nsd/WifiP2pUsdBasedServiceConfig) objects for USD based service discovery and advertisement.\n\nSummary\n-------\n\n| Public constructors ||\n|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------|---|\n| [Builder](#Builder(kotlin.String))`(`serviceName:` `[String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)`)` Constructor for [Builder](#). |\n\n| Public methods ||\n|---------------------------------------------------------------------------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| [WifiP2pUsdBasedServiceConfig](/reference/kotlin/android/net/wifi/p2p/nsd/WifiP2pUsdBasedServiceConfig) | [build](#build())`()` Build [WifiP2pUsdBasedServiceConfig](/reference/kotlin/android/net/wifi/p2p/nsd/WifiP2pUsdBasedServiceConfig) given the current requests made on the builder. |\n| [WifiP2pUsdBasedServiceConfig.Builder](#) | [setServiceProtocolType](#setServiceProtocolType(kotlin.Int))`(`serviceProtocolType:` `[Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)`)` Specify the service discovery protocol type. |\n| [WifiP2pUsdBasedServiceConfig.Builder](#) | [setServiceSpecificInfo](#setServiceSpecificInfo(kotlin.ByteArray))`(`serviceSpecificInfo:` `[ByteArray](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-byte-array/index.html)?`)` Specify service specific information content determined by the application. |\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(serviceName: String)\n```\n\nConstructor for [Builder](#).\n\n| Parameters ||\n|---------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| `serviceName` | [String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html): The service name defining the service. The maximum allowed length of the service name is 100 characters. This value cannot be `null`. |\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(): WifiP2pUsdBasedServiceConfig\n```\n\nBuild [WifiP2pUsdBasedServiceConfig](/reference/kotlin/android/net/wifi/p2p/nsd/WifiP2pUsdBasedServiceConfig) given the current requests made on the builder.\n\n| Return ||\n|---------------------------------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| [WifiP2pUsdBasedServiceConfig](/reference/kotlin/android/net/wifi/p2p/nsd/WifiP2pUsdBasedServiceConfig) | [WifiP2pUsdBasedServiceConfig](/reference/kotlin/android/net/wifi/p2p/nsd/WifiP2pUsdBasedServiceConfig) constructed based on builder method calls. This value cannot be `null`. |\n\n### setServiceProtocolType\n\nAdded in [API level 36](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels) \n\n```\nfun setServiceProtocolType(serviceProtocolType: Int): WifiP2pUsdBasedServiceConfig.Builder\n```\n\nSpecify the service discovery protocol type.\n\nOptional. `SERVICE_PROTOCOL_TYPE_GENERIC` by default.\n\n| Parameters ||\n|-----------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| `serviceProtocolType` | [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html): One of the `SERVICE_PROTOCOL_TYPE_*` or a non-negative number set by the service layer. Value is between 0 and 255 inclusive |\n\n| Return ||\n|-------------------------------------------|--------------------------------------------------------------------------------------------------|\n| [WifiP2pUsdBasedServiceConfig.Builder](#) | The builder to facilitate chaining `builder.setXXX(..).setXXX(..)`. This value cannot be `null`. |\n\n### setServiceSpecificInfo\n\nAdded in [API level 36](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels) \n\n```\nfun setServiceSpecificInfo(serviceSpecificInfo: ByteArray?): WifiP2pUsdBasedServiceConfig.Builder\n```\n\nSpecify service specific information content determined by the application.\n\nOptional. Empty by default.\n\n| Parameters ||\n|-----------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| `serviceSpecificInfo` | [ByteArray](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-byte-array/index.html)?: A byte-array of service-specific information available to the application to send additional information. Users must call [getMaxAllowedServiceSpecificInfoLength()](/reference/kotlin/android/net/wifi/p2p/nsd/WifiP2pUsdBasedServiceConfig#getMaxAllowedServiceSpecificInfoLength()) method to know maximum allowed legth. This value may be `null`. |\n\n| Return ||\n|-------------------------------------------|--------------------------------------------------------------------------------------------------|\n| [WifiP2pUsdBasedServiceConfig.Builder](#) | The builder to facilitate chaining `builder.setXXX(..).setXXX(..)`. This value cannot be `null`. |"]]