Stay organized with collections
Save and categorize content based on your preferences.
Builder
class Builder
A builder for creating new AdvertisingRequest
objects.
Summary
Public constructors |
Creates a new Builder object.
|
Public constructors
Public methods
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,["# AdvertisingRequest.Builder\n\nAdded in [API level 36](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels) \nAlso in [T Extensions 17](https://developer.android.com/sdkExtensions)\n\nBuilder\n=======\n\n*** ** * ** ***\n\nKotlin \\|[Java](/reference/android/net/nsd/AdvertisingRequest.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.nsd.AdvertisingRequest.Builder](#) |\n\nA builder for creating new [AdvertisingRequest](/reference/kotlin/android/net/nsd/AdvertisingRequest) objects.\n\nSummary\n-------\n\n| Public constructors ||\n|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|---|\n| [Builder](#Builder(android.net.nsd.NsdServiceInfo))`(`serviceInfo:` `[NsdServiceInfo](/reference/kotlin/android/net/nsd/NsdServiceInfo)`)` Creates a new [Builder](#) object. |\n\n| Public methods ||\n|----------------------------------------------------------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| [AdvertisingRequest](/reference/kotlin/android/net/nsd/AdvertisingRequest) | [build](#build())`()` Creates a new [AdvertisingRequest](/reference/kotlin/android/net/nsd/AdvertisingRequest) object. |\n| [AdvertisingRequest.Builder](#) | [setFlags](#setFlags(kotlin.Long))`(`flags:` `[Long](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-long/index.html)`)` Sets advertising configuration flags. |\n| [AdvertisingRequest.Builder](#) | [setProtocolType](#setProtocolType(kotlin.Int))`(`protocolType:` `[Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)`)` Sets the protocol to use for advertising. |\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) \nAlso in [T Extensions 17](https://developer.android.com/sdkExtensions) \n\n```\nBuilder(serviceInfo: NsdServiceInfo)\n```\n\nCreates a new [Builder](#) object.\n\n| Parameters ||\n|---------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| `serviceInfo` | [NsdServiceInfo](/reference/kotlin/android/net/nsd/NsdServiceInfo): the [NsdServiceInfo](/reference/kotlin/android/net/nsd/NsdServiceInfo) describing the service to advertise. 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) \nAlso in [T Extensions 17](https://developer.android.com/sdkExtensions) \n\n```\nfun build(): AdvertisingRequest\n```\n\nCreates a new [AdvertisingRequest](/reference/kotlin/android/net/nsd/AdvertisingRequest) object.\n\n| Return ||\n|----------------------------------------------------------------------------|------------------------------|\n| [AdvertisingRequest](/reference/kotlin/android/net/nsd/AdvertisingRequest) | This value cannot be `null`. |\n\n### setFlags\n\nAdded in [API level 36](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels) \nAlso in [T Extensions 17](https://developer.android.com/sdkExtensions) \n\n```\nfun setFlags(flags: Long): AdvertisingRequest.Builder\n```\n\nSets advertising configuration flags.\n\n| Parameters ||\n|---------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| `flags` | [Long](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-long/index.html): flags to use for advertising. Value is either `0` or [android.net.nsd.AdvertisingRequest#FLAG_SKIP_PROBING](/reference/kotlin/android/net/nsd/AdvertisingRequest#FLAG_SKIP_PROBING:kotlin.Long) |\n\n| Return ||\n|---------------------------------|------------------------------|\n| [AdvertisingRequest.Builder](#) | This value cannot be `null`. |\n\n### setProtocolType\n\nAdded in [API level 36](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels) \nAlso in [T Extensions 17](https://developer.android.com/sdkExtensions) \n\n```\nfun setProtocolType(protocolType: Int): AdvertisingRequest.Builder\n```\n\nSets the protocol to use for advertising.\n\n| Parameters ||\n|----------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| `protocolType` | [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html): the advertising protocol to use. Value is [android.net.nsd.NsdManager#PROTOCOL_DNS_SD](/reference/kotlin/android/net/nsd/NsdManager#PROTOCOL_DNS_SD:kotlin.Int) |\n\n| Return ||\n|---------------------------------|------------------------------|\n| [AdvertisingRequest.Builder](#) | This value cannot be `null`. |"]]