# WifiInfo.Builder

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

# Builder

*** ** * ** ***

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

```
class Builder
```

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

Builder for WifiInfo

## Summary

|                                                 Public constructors                                                 ||
|------------------------------------------------------------------------------------------------------------------|---|
| [Builder](https://developer.android.com/reference/kotlin/android/net/wifi/WifiInfo.Builder#Builder())`()` <br /> |

|                                                                                                                                                                                   Public methods                                                                                                                                                                                   ||
|-------------------------------------------------------------------------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| [WifiInfo](https://developer.android.com/reference/kotlin/android/net/wifi/WifiInfo)                  | [build](https://developer.android.com/reference/kotlin/android/net/wifi/WifiInfo.Builder#build())`()` Build a WifiInfo object.                                                                                                                                              |
| [WifiInfo.Builder](https://developer.android.com/reference/kotlin/android/net/wifi/WifiInfo.Builder#) | [setBssid](https://developer.android.com/reference/kotlin/android/net/wifi/WifiInfo.Builder#setBssid(kotlin.String))`(`bssid:` `[String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)`)` Set the BSSID.                                          |
| [WifiInfo.Builder](https://developer.android.com/reference/kotlin/android/net/wifi/WifiInfo.Builder#) | [setCurrentSecurityType](https://developer.android.com/reference/kotlin/android/net/wifi/WifiInfo.Builder#setCurrentSecurityType(kotlin.Int))`(`securityType:` `[Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)`)` Set the current security type |
| [WifiInfo.Builder](https://developer.android.com/reference/kotlin/android/net/wifi/WifiInfo.Builder#) | [setNetworkId](https://developer.android.com/reference/kotlin/android/net/wifi/WifiInfo.Builder#setNetworkId(kotlin.Int))`(`networkId:` `[Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)`)` Set the network ID.                                  |
| [WifiInfo.Builder](https://developer.android.com/reference/kotlin/android/net/wifi/WifiInfo.Builder#) | [setRssi](https://developer.android.com/reference/kotlin/android/net/wifi/WifiInfo.Builder#setRssi(kotlin.Int))`(`rssi:` `[Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)`)` Set the RSSI, in dBm.                                               |
| [WifiInfo.Builder](https://developer.android.com/reference/kotlin/android/net/wifi/WifiInfo.Builder#) | [setSsid](https://developer.android.com/reference/kotlin/android/net/wifi/WifiInfo.Builder#setSsid(kotlin.ByteArray))`(`ssid:` `[ByteArray](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-byte-array/index.html)`)` Set the SSID, in the form of a raw byte array.   |
| [WifiInfo.Builder](https://developer.android.com/reference/kotlin/android/net/wifi/WifiInfo.Builder#) | [setSubscriptionId](https://developer.android.com/reference/kotlin/android/net/wifi/WifiInfo.Builder#setSubscriptionId(kotlin.Int))`(`subId:` `[Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)`)` Set the subscription ID.                       |

## Public constructors

### Builder

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

```
Builder()
```

## Public methods

### build

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

```
fun build(): WifiInfo
```

Build a WifiInfo object.

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

### setBssid

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

```
fun setBssid(bssid: String): WifiInfo.Builder
```

Set the BSSID.

|                                                      Parameters                                                       ||
|---------|--------------------------------------------------------------------------------------------------------------|
| `bssid` | [String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html):This value cannot be`null`. |

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

**See Also**

- [android.net.wifi.WifiInfo#getBSSID()](https://developer.android.com/reference/kotlin/android/net/wifi/WifiInfo#getBSSID())  

### setCurrentSecurityType

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

```
fun setCurrentSecurityType(securityType: Int): WifiInfo.Builder
```

Set the current security type

|                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     Parameters                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     ||
|----------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `securityType` | [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html):Value is[android.net.wifi.WifiConfiguration#SECURITY_TYPE_OPEN](https://developer.android.com/reference/kotlin/android/net/wifi/WifiConfiguration#SECURITY_TYPE_OPEN:kotlin.Int),[android.net.wifi.WifiConfiguration#SECURITY_TYPE_WEP](https://developer.android.com/reference/kotlin/android/net/wifi/WifiConfiguration#SECURITY_TYPE_WEP:kotlin.Int),[android.net.wifi.WifiConfiguration#SECURITY_TYPE_PSK](https://developer.android.com/reference/kotlin/android/net/wifi/WifiConfiguration#SECURITY_TYPE_PSK:kotlin.Int),[android.net.wifi.WifiConfiguration#SECURITY_TYPE_EAP](https://developer.android.com/reference/kotlin/android/net/wifi/WifiConfiguration#SECURITY_TYPE_EAP:kotlin.Int),[android.net.wifi.WifiConfiguration#SECURITY_TYPE_SAE](https://developer.android.com/reference/kotlin/android/net/wifi/WifiConfiguration#SECURITY_TYPE_SAE:kotlin.Int),[android.net.wifi.WifiConfiguration#SECURITY_TYPE_EAP_SUITE_B](https://developer.android.com/reference/kotlin/android/net/wifi/WifiConfiguration#SECURITY_TYPE_EAP_SUITE_B:kotlin.Int),[android.net.wifi.WifiConfiguration#SECURITY_TYPE_OWE](https://developer.android.com/reference/kotlin/android/net/wifi/WifiConfiguration#SECURITY_TYPE_OWE:kotlin.Int),[android.net.wifi.WifiConfiguration#SECURITY_TYPE_WAPI_PSK](https://developer.android.com/reference/kotlin/android/net/wifi/WifiConfiguration#SECURITY_TYPE_WAPI_PSK:kotlin.Int),[android.net.wifi.WifiConfiguration#SECURITY_TYPE_WAPI_CERT](https://developer.android.com/reference/kotlin/android/net/wifi/WifiConfiguration#SECURITY_TYPE_WAPI_CERT:kotlin.Int),[android.net.wifi.WifiConfiguration#SECURITY_TYPE_EAP_WPA3_ENTERPRISE](https://developer.android.com/reference/kotlin/android/net/wifi/WifiConfiguration#SECURITY_TYPE_EAP_WPA3_ENTERPRISE:kotlin.Int),[android.net.wifi.WifiConfiguration#SECURITY_TYPE_EAP_WPA3_ENTERPRISE_192_BIT](https://developer.android.com/reference/kotlin/android/net/wifi/WifiConfiguration#SECURITY_TYPE_EAP_WPA3_ENTERPRISE_192_BIT:kotlin.Int), android.net.wifi.WifiConfiguration.SECURITY_TYPE_PASSPOINT_R1_R2, android.net.wifi.WifiConfiguration.SECURITY_TYPE_PASSPOINT_R3, or[android.net.wifi.WifiConfiguration#SECURITY_TYPE_DPP](https://developer.android.com/reference/kotlin/android/net/wifi/WifiConfiguration#SECURITY_TYPE_DPP:kotlin.Int) |

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

**See Also**

- [android.net.wifi.WifiInfo#getCurrentSecurityType()](https://developer.android.com/reference/kotlin/android/net/wifi/WifiInfo#getCurrentSecurityType())  

### setNetworkId

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

```
fun setNetworkId(networkId: Int): WifiInfo.Builder
```

Set the network ID.

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

**See Also**

- [android.net.wifi.WifiInfo#getNetworkId()](https://developer.android.com/reference/kotlin/android/net/wifi/WifiInfo#getNetworkId())  

### setRssi

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

```
fun setRssi(rssi: Int): WifiInfo.Builder
```

Set the RSSI, in dBm.

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

**See Also**

- [android.net.wifi.WifiInfo#getRssi()](https://developer.android.com/reference/kotlin/android/net/wifi/WifiInfo#getRssi())  

### setSsid

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

```
fun setSsid(ssid: ByteArray): WifiInfo.Builder
```

Set the SSID, in the form of a raw byte array.

|                                                         Parameters                                                          ||
|--------|---------------------------------------------------------------------------------------------------------------------|
| `ssid` | [ByteArray](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-byte-array/index.html):This value cannot be`null`. |

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

**See Also**

- [android.net.wifi.WifiInfo#getSSID()](https://developer.android.com/reference/kotlin/android/net/wifi/WifiInfo#getSSID())  

### setSubscriptionId

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

```
fun setSubscriptionId(subId: Int): WifiInfo.Builder
```

Set the subscription ID.

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

**See Also**

- [android.net.wifi.WifiInfo#getSubscriptionId()](https://developer.android.com/reference/kotlin/android/net/wifi/WifiInfo#getSubscriptionId())