Stay organized with collections
Save and categorize content based on your preferences.
Builder
class Builder
This class is used to incrementally build VcnConfig
objects.
Summary
Public constructors
Builder
Builder(context: Context)
Parameters |
context |
Context: This value cannot be null . |
Public methods
build
fun build(): VcnConfig
Builds and validates the VcnConfig.
Return |
VcnConfig |
an immutable VcnConfig instance This value cannot be null . |
setRestrictedUnderlyingNetworkTransports
fun setRestrictedUnderlyingNetworkTransports(transports: MutableSet<Int!>): VcnConfig.Builder
Sets transports that will be restricted by the VCN.
In general, apps will not be able to bind to, or use a restricted network. In other words, unless the network type is marked restricted, any app can opt to use underlying networks, instead of through the VCN.
Exceptions |
java.lang.IllegalArgumentException |
if the input contains unsupported transport types. |
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,["# VcnConfig.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/net/vcn/VcnConfig.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.vcn.VcnConfig.Builder](#) |\n\nThis class is used to incrementally build [VcnConfig](/reference/kotlin/android/net/vcn/VcnConfig) objects.\n\nSummary\n-------\n\n| Public constructors ||\n|------------------------------------------------------------------------------------------------------------|---|\n| [Builder](#Builder(android.content.Context))`(`context:` `[Context](../../content/Context.html#)`)` \u003cbr /\u003e |\n\n| Public methods ||\n|----------------------------------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| [VcnConfig.Builder](#) | [addGatewayConnectionConfig](#addGatewayConnectionConfig(android.net.vcn.VcnGatewayConnectionConfig))`(`gatewayConnectionConfig:` `[VcnGatewayConnectionConfig](/reference/kotlin/android/net/vcn/VcnGatewayConnectionConfig)`)` Adds a configuration for an individual gateway connection. |\n| [VcnConfig](/reference/kotlin/android/net/vcn/VcnConfig) | [build](#build())`()` Builds and validates the VcnConfig. |\n| [VcnConfig.Builder](#) | [setRestrictedUnderlyingNetworkTransports](#setRestrictedUnderlyingNetworkTransports(kotlin.collections.MutableSet))`(`transports:` `[MutableSet](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.collections/-mutable-set/index.html)\u003c[Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)!\u003e`)` Sets transports that will be restricted by the VCN. |\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(context: Context)\n```\n\n| Parameters ||\n|-----------|----------------------------------------------------------------------|\n| `context` | [Context](../../content/Context.html#): This value cannot be `null`. |\n\nPublic methods\n--------------\n\n### addGatewayConnectionConfig\n\nAdded in [API level 31](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels) \n\n```\nfun addGatewayConnectionConfig(gatewayConnectionConfig: VcnGatewayConnectionConfig): VcnConfig.Builder\n```\n\nAdds a configuration for an individual gateway connection.\n\n| Parameters ||\n|---------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| `gatewayConnectionConfig` | [VcnGatewayConnectionConfig](/reference/kotlin/android/net/vcn/VcnGatewayConnectionConfig): the configuration for an individual gateway connection This value cannot be `null`. |\n\n| Return ||\n|------------------------|-----------------------------------------------------------------------|\n| [VcnConfig.Builder](#) | this [Builder](#) instance, for chaining This value cannot be `null`. |\n\n| Exceptions ||\n|--------------------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| `java.lang.IllegalArgumentException` | if a VcnGatewayConnectionConfig has already been set for this [VcnConfig](/reference/kotlin/android/net/vcn/VcnConfig) with the same GatewayConnection name (as returned via [android.net.vcn.VcnGatewayConnectionConfig#getGatewayConnectionName()](/reference/kotlin/android/net/vcn/VcnGatewayConnectionConfig#getGatewayConnectionName())). |\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(): VcnConfig\n```\n\nBuilds and validates the VcnConfig.\n\n| Return ||\n|----------------------------------------------------------|--------------------------------------------------------------|\n| [VcnConfig](/reference/kotlin/android/net/vcn/VcnConfig) | an immutable VcnConfig instance This value cannot be `null`. |\n\n### setRestrictedUnderlyingNetworkTransports\n\nAdded in [API level 34](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels) \n\n```\nfun setRestrictedUnderlyingNetworkTransports(transports: MutableSet\u003cInt!\u003e): VcnConfig.Builder\n```\n\nSets transports that will be restricted by the VCN.\n\nIn general, apps will not be able to bind to, or use a restricted network. In other words, unless the network type is marked restricted, any app can opt to use underlying networks, instead of through the VCN.\n\n| Parameters ||\n|--------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| `transports` | [MutableSet](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.collections/-mutable-set/index.html)\\\u003c[Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)!\\\u003e: transports that will be restricted by VCN. Networks that include any of the transports will be marked as restricted. [android.net.NetworkCapabilities#TRANSPORT_WIFI](../NetworkCapabilities.html#TRANSPORT_WIFI:kotlin.Int) is marked restricted by default. This value cannot be `null`. |\n\n| Return ||\n|------------------------|-----------------------------------------------------------------------|\n| [VcnConfig.Builder](#) | this [Builder](#) instance, for chaining This value cannot be `null`. |\n\n| Exceptions ||\n|--------------------------------------|----------------------------------------------------|\n| `java.lang.IllegalArgumentException` | if the input contains unsupported transport types. |\n\n**See Also**\n\n- [android.net.NetworkCapabilities#NET_CAPABILITY_NOT_RESTRICTED](../NetworkCapabilities.html#NET_CAPABILITY_NOT_RESTRICTED:kotlin.Int)"]]