# VcnWifiUnderlyingNetworkTemplate.Builder

Added in[API level 33](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

# Builder

*** ** * ** ***

Kotlin\|[Java](https://developer.android.com/reference/android/net/vcn/VcnWifiUnderlyingNetworkTemplate.Builder "View this page in Java")  

```
class Builder
```

|---|----------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| [kotlin.Any](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-any/index.html)                                                                                       ||
| ↳ | [android.net.vcn.VcnWifiUnderlyingNetworkTemplate.Builder](https://developer.android.com/reference/kotlin/android/net/vcn/VcnWifiUnderlyingNetworkTemplate.Builder#) |

This class is used to incrementally build VcnWifiUnderlyingNetworkTemplate objects.

## Summary

|                                                                       Public constructors                                                                       ||
|--------------------------------------------------------------------------------------------------------------------------------------------------------------|---|
| [Builder](https://developer.android.com/reference/kotlin/android/net/vcn/VcnWifiUnderlyingNetworkTemplate.Builder#Builder())`()` Construct a Builder object. |

|                                                                                                                                                                                                                                                                                                                        Public methods                                                                                                                                                                                                                                                                                                                        ||
|------------------------------------------------------------------------------------------------------------------------------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| [VcnWifiUnderlyingNetworkTemplate](https://developer.android.com/reference/kotlin/android/net/vcn/VcnWifiUnderlyingNetworkTemplate)                  | [build](https://developer.android.com/reference/kotlin/android/net/vcn/VcnWifiUnderlyingNetworkTemplate.Builder#build())`()` Build the VcnWifiUnderlyingNetworkTemplate.                                                                                                                                                                                                                                                                                                                               |
| [VcnWifiUnderlyingNetworkTemplate.Builder](https://developer.android.com/reference/kotlin/android/net/vcn/VcnWifiUnderlyingNetworkTemplate.Builder#) | [setMetered](https://developer.android.com/reference/kotlin/android/net/vcn/VcnWifiUnderlyingNetworkTemplate.Builder#setMetered(kotlin.Int))`(`matchCriteria:` `[Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)`)` Set the matching criteria for metered networks.                                                                                                                                                                                                          |
| [VcnWifiUnderlyingNetworkTemplate.Builder](https://developer.android.com/reference/kotlin/android/net/vcn/VcnWifiUnderlyingNetworkTemplate.Builder#) | [setMinDownstreamBandwidthKbps](https://developer.android.com/reference/kotlin/android/net/vcn/VcnWifiUnderlyingNetworkTemplate.Builder#setMinDownstreamBandwidthKbps(kotlin.Int,%20kotlin.Int))`(`minEntryDownstreamBandwidthKbps:` `[Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)`, `minExitDownstreamBandwidthKbps:` `[Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)`)` Set the minimum upstream bandwidths that this template will match. |
| [VcnWifiUnderlyingNetworkTemplate.Builder](https://developer.android.com/reference/kotlin/android/net/vcn/VcnWifiUnderlyingNetworkTemplate.Builder#) | [setMinUpstreamBandwidthKbps](https://developer.android.com/reference/kotlin/android/net/vcn/VcnWifiUnderlyingNetworkTemplate.Builder#setMinUpstreamBandwidthKbps(kotlin.Int,%20kotlin.Int))`(`minEntryUpstreamBandwidthKbps:` `[Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)`, `minExitUpstreamBandwidthKbps:` `[Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)`)` Set the minimum upstream bandwidths that this template will match.         |
| [VcnWifiUnderlyingNetworkTemplate.Builder](https://developer.android.com/reference/kotlin/android/net/vcn/VcnWifiUnderlyingNetworkTemplate.Builder#) | [setSsids](https://developer.android.com/reference/kotlin/android/net/vcn/VcnWifiUnderlyingNetworkTemplate.Builder#setSsids(kotlin.collections.MutableSet))`(`ssids:` `[MutableSet](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.collections/-mutable-set/index.html)<[String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)!>`)` Set the SSIDs with which a network can match this priority rule.                                                                    |

## Public constructors

### Builder

Added in[API level 33](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  

```
Builder()
```

Construct a Builder object.

## Public methods

### build

Added in[API level 33](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  

```
fun build(): VcnWifiUnderlyingNetworkTemplate
```

Build the VcnWifiUnderlyingNetworkTemplate.

|                                                                              Return                                                                              ||
|-------------------------------------------------------------------------------------------------------------------------------------|-----------------------------|
| [VcnWifiUnderlyingNetworkTemplate](https://developer.android.com/reference/kotlin/android/net/vcn/VcnWifiUnderlyingNetworkTemplate) | This value cannot be`null`. |

### setMetered

Added in[API level 33](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  

```
fun setMetered(matchCriteria: Int): VcnWifiUnderlyingNetworkTemplate.Builder
```

Set the matching criteria for metered networks.

A template where setMetered(MATCH_REQUIRED) will only match metered networks (one without NET_CAPABILITY_NOT_METERED). A template where setMetered(MATCH_FORBIDDEN) will only match a network that is not metered (one with NET_CAPABILITY_NOT_METERED).

|                                                                                                                                                                                                                                                                                                                                                                                                                     Parameters                                                                                                                                                                                                                                                                                                                                                                                                                      ||
|-----------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `matchCriteria` | [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html):the matching criteria for metered networks. Defaults to[MATCH_ANY](https://developer.android.com/reference/kotlin/android/net/vcn/VcnUnderlyingNetworkTemplate#MATCH_ANY:kotlin.Int). Value is[android.net.vcn.VcnUnderlyingNetworkTemplate#MATCH_ANY](https://developer.android.com/reference/kotlin/android/net/vcn/VcnUnderlyingNetworkTemplate#MATCH_ANY:kotlin.Int),[android.net.vcn.VcnUnderlyingNetworkTemplate#MATCH_REQUIRED](https://developer.android.com/reference/kotlin/android/net/vcn/VcnUnderlyingNetworkTemplate#MATCH_REQUIRED:kotlin.Int), or[android.net.vcn.VcnUnderlyingNetworkTemplate#MATCH_FORBIDDEN](https://developer.android.com/reference/kotlin/android/net/vcn/VcnUnderlyingNetworkTemplate#MATCH_FORBIDDEN:kotlin.Int) |

|                                                                                      Return                                                                                       ||
|------------------------------------------------------------------------------------------------------------------------------------------------------|-----------------------------|
| [VcnWifiUnderlyingNetworkTemplate.Builder](https://developer.android.com/reference/kotlin/android/net/vcn/VcnWifiUnderlyingNetworkTemplate.Builder#) | This value cannot be`null`. |

**See Also**

- [android.net.NetworkCapabilities#NET_CAPABILITY_NOT_METERED](https://developer.android.com/reference/kotlin/android/net/NetworkCapabilities.html#NET_CAPABILITY_NOT_METERED:kotlin.Int)  

### setMinDownstreamBandwidthKbps

Added in[API level 33](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  

```
fun setMinDownstreamBandwidthKbps(
    minEntryDownstreamBandwidthKbps: Int, 
    minExitDownstreamBandwidthKbps: Int
): VcnWifiUnderlyingNetworkTemplate.Builder
```

Set the minimum upstream bandwidths that this template will match.

This template will not match a network that does not provide at least the bandwidth passed as the entry bandwidth, except in the case that the network is selected as the VCN Gateway Connection's underlying network, where it will continue to match until the bandwidth drops under the exit bandwidth.

The entry criteria MUST be greater than, or equal to the exit criteria to avoid the invalid case where a network fulfills the entry criteria, but at the same time fails the exit criteria.

Estimated bandwidth of a network is provided by the transport layer, and reported in[NetworkCapabilities](https://developer.android.com/reference/kotlin/android/net/NetworkCapabilities.html#). The provided estimates will be used without modification.

|                                                                                                                                    Parameters                                                                                                                                     ||
|-----------------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `minEntryDownstreamBandwidthKbps` | [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html):the minimum accepted downstream bandwidth for networks that ARE NOT the already-selected underlying network, or`0`to disable this requirement. Disabled by default. |
| `minExitDownstreamBandwidthKbps`  | [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html):the minimum accepted downstream bandwidth for a network that IS the already-selected underlying network, or`0`to disable this requirement. Disabled by default.     |

|                                                                                                                                                             Return                                                                                                                                                              ||
|------------------------------------------------------------------------------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| [VcnWifiUnderlyingNetworkTemplate.Builder](https://developer.android.com/reference/kotlin/android/net/vcn/VcnWifiUnderlyingNetworkTemplate.Builder#) | this[Builder](https://developer.android.com/reference/kotlin/android/net/vcn/VcnWifiUnderlyingNetworkTemplate.Builder#)instance, for chaining This value cannot be`null`. |

### setMinUpstreamBandwidthKbps

Added in[API level 33](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  

```
fun setMinUpstreamBandwidthKbps(
    minEntryUpstreamBandwidthKbps: Int, 
    minExitUpstreamBandwidthKbps: Int
): VcnWifiUnderlyingNetworkTemplate.Builder
```

Set the minimum upstream bandwidths that this template will match.

This template will not match a network that does not provide at least the bandwidth passed as the entry bandwidth, except in the case that the network is selected as the VCN Gateway Connection's underlying network, where it will continue to match until the bandwidth drops under the exit bandwidth.

The entry criteria MUST be greater than, or equal to the exit criteria to avoid the invalid case where a network fulfills the entry criteria, but at the same time fails the exit criteria.

Estimated bandwidth of a network is provided by the transport layer, and reported in[NetworkCapabilities](https://developer.android.com/reference/kotlin/android/net/NetworkCapabilities.html#). The provided estimates will be used without modification.

|                                                                                                                                  Parameters                                                                                                                                   ||
|---------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `minEntryUpstreamBandwidthKbps` | [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html):the minimum accepted upstream bandwidth for networks that ARE NOT the already-selected underlying network, or`0`to disable this requirement. Disabled by default. |
| `minExitUpstreamBandwidthKbps`  | [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html):the minimum accepted upstream bandwidth for a network that IS the already-selected underlying network, or`0`to disable this requirement. Disabled by default.     |

|                                                                                                                                                             Return                                                                                                                                                              ||
|------------------------------------------------------------------------------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| [VcnWifiUnderlyingNetworkTemplate.Builder](https://developer.android.com/reference/kotlin/android/net/vcn/VcnWifiUnderlyingNetworkTemplate.Builder#) | this[Builder](https://developer.android.com/reference/kotlin/android/net/vcn/VcnWifiUnderlyingNetworkTemplate.Builder#)instance, for chaining This value cannot be`null`. |

### setSsids

Added in[API level 33](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  

```
fun setSsids(ssids: MutableSet<String!>): VcnWifiUnderlyingNetworkTemplate.Builder
```

Set the SSIDs with which a network can match this priority rule.

|                                                                                                                                                                                           Parameters                                                                                                                                                                                            ||
|---------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `ssids` | [MutableSet](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.collections/-mutable-set/index.html)\<[String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)!\>:the matching SSIDs. Network with one of the matching SSIDs can match this priority rule. If the set is empty, any SSID will match. The default is an empty set. This value cannot be`null`. |

|                                                                                      Return                                                                                       ||
|------------------------------------------------------------------------------------------------------------------------------------------------------|-----------------------------|
| [VcnWifiUnderlyingNetworkTemplate.Builder](https://developer.android.com/reference/kotlin/android/net/vcn/VcnWifiUnderlyingNetworkTemplate.Builder#) | This value cannot be`null`. |