Stay organized with collections
Save and categorize content based on your preferences.
Builder
class Builder
Provides a convenient way to set the fields of a TrafficDescriptor
when creating a new instance.
The example below shows how you might create a new TrafficDescriptor
:
<code>
TrafficDescriptor response = new TrafficDescriptor.Builder()
.setDnn("")
.build();
</code>
Summary
Public constructors |
Default constructor for Builder.
|
Public constructors
Builder
Builder()
Default constructor for Builder.
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-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,["# TrafficDescriptor.Builder\n\nAdded in [API level 31](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)\n\nBuilder\n=======\n\n*** ** * ** ***\n\nKotlin \\|[Java](/reference/android/telephony/data/TrafficDescriptor.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.telephony.data.TrafficDescriptor.Builder](#) |\n\nProvides a convenient way to set the fields of a [TrafficDescriptor](/reference/kotlin/android/telephony/data/TrafficDescriptor) when creating a new instance.\n\nThe example below shows how you might create a new `TrafficDescriptor`: \n\n```kotlin\n\u003ccode\u003e\n \n TrafficDescriptor response = new TrafficDescriptor.Builder()\n .setDnn(\"\")\n .build();\n \u003c/code\u003e\n```\n\nSummary\n-------\n\n| Public constructors ||\n|------------------------------------------------------------|---|\n| [Builder](#Builder())`()` Default constructor for Builder. |\n\n| Public methods ||\n|---------------------------------------------------------------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| [TrafficDescriptor](/reference/kotlin/android/telephony/data/TrafficDescriptor) | [build](#build())`()` Build the [TrafficDescriptor](/reference/kotlin/android/telephony/data/TrafficDescriptor). |\n| [TrafficDescriptor.Builder](#) | [setDataNetworkName](#setDataNetworkName(kotlin.String))`(`dnn:` `[String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)`)` Set the Data Network Name(DNN). |\n| [TrafficDescriptor.Builder](#) | [setOsAppId](#setOsAppId(kotlin.ByteArray))`(`osAppId:` `[ByteArray](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-byte-array/index.html)`)` Set the OS App ID (including OS Id as defined in the specs). |\n\nPublic constructors\n-------------------\n\n### Builder\n\nAdded in [API level 31](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels) \n\n```\nBuilder()\n```\n\nDefault constructor for Builder.\n\nPublic methods\n--------------\n\n### build\n\nAdded in [API level 31](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels) \n\n```\nfun build(): TrafficDescriptor\n```\n\nBuild the [TrafficDescriptor](/reference/kotlin/android/telephony/data/TrafficDescriptor).\n\n| Return ||\n|---------------------------------------------------------------------------------|--------------------------------------------------------------------------------------------------------------------------|\n| [TrafficDescriptor](/reference/kotlin/android/telephony/data/TrafficDescriptor) | the [TrafficDescriptor](/reference/kotlin/android/telephony/data/TrafficDescriptor) object. This value cannot be `null`. |\n\n| Exceptions ||\n|--------------------------------------|--------------------------------|\n| `java.lang.IllegalArgumentException` | if DNN and OS App ID are null. |\n\n### setDataNetworkName\n\nAdded in [API level 31](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels) \n\n```\nfun setDataNetworkName(dnn: String): TrafficDescriptor.Builder\n```\n\nSet the Data Network Name(DNN).\n\n| Parameters ||\n|-------|----------------------------------------------------------------------------------------------------------------|\n| `dnn` | [String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html): This value cannot be `null`. |\n\n| Return ||\n|--------------------------------|----------------------------------------------------------------|\n| [TrafficDescriptor.Builder](#) | The same instance of the builder. This value cannot be `null`. |\n\n### setOsAppId\n\nAdded in [API level 31](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels) \n\n```\nfun setOsAppId(osAppId: ByteArray): TrafficDescriptor.Builder\n```\n\nSet the OS App ID (including OS Id as defined in the specs).\n\n| Parameters ||\n|-----------|-----------------------------------------------------------------------------------------------------------------------|\n| `osAppId` | [ByteArray](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-byte-array/index.html): This value cannot be `null`. |\n\n| Return ||\n|--------------------------------|----------------------------------------------------------------|\n| [TrafficDescriptor.Builder](#) | The same instance of the builder. This value cannot be `null`. |"]]