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

# Builder

*** ** * ** ***

```
class Builder
```

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

Builder used to build `https://developer.android.com/reference/kotlin/android/net/wifi/p2p/WifiP2pConfig` objects for creating or joining a group. The WifiP2pConfig can be constructed for two use-cases:

- SSID + Passphrase are known: use `https://developer.android.com/reference/kotlin/android/net/wifi/p2p/WifiP2pConfig.Builder#setNetworkName(kotlin.String)` and `https://developer.android.com/reference/kotlin/android/net/wifi/p2p/WifiP2pConfig.Builder#setPassphrase(kotlin.String)`.
- SSID or Passphrase is unknown, in such a case the MAC address must be known and specified using `https://developer.android.com/reference/kotlin/android/net/wifi/p2p/WifiP2pConfig.Builder#setDeviceAddress(android.net.MacAddress)`.

<br />

## Summary

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

| Public methods ||
|---|---|
| [WifiP2pConfig](https://developer.android.com/reference/kotlin/android/net/wifi/p2p/WifiP2pConfig) | `https://developer.android.com/reference/kotlin/android/net/wifi/p2p/WifiP2pConfig.Builder#build()()` Build `https://developer.android.com/reference/kotlin/android/net/wifi/p2p/WifiP2pConfig` given the current requests made on the builder. |
| [WifiP2pConfig.Builder](https://developer.android.com/reference/kotlin/android/net/wifi/p2p/WifiP2pConfig.Builder#) | `https://developer.android.com/reference/kotlin/android/net/wifi/p2p/WifiP2pConfig.Builder#enablePersistentMode(kotlin.Boolean)(persistent: https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html)` Specify that the group configuration be persisted (i.e. saved). |
| [WifiP2pConfig.Builder](https://developer.android.com/reference/kotlin/android/net/wifi/p2p/WifiP2pConfig.Builder#) | `https://developer.android.com/reference/kotlin/android/net/wifi/p2p/WifiP2pConfig.Builder#setAuthorizeConnectionFromPeerEnabled(kotlin.Boolean)(enabled: https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html)` Specify that the configuration is to authorize a connection request from a peer device. |
| [WifiP2pConfig.Builder](https://developer.android.com/reference/kotlin/android/net/wifi/p2p/WifiP2pConfig.Builder#) | `https://developer.android.com/reference/kotlin/android/net/wifi/p2p/WifiP2pConfig.Builder#setDeviceAddress(android.net.MacAddress)(deviceAddress: https://developer.android.com/reference/kotlin/android/net/MacAddress.html#?)` Specify the peer's MAC address. |
| [WifiP2pConfig.Builder](https://developer.android.com/reference/kotlin/android/net/wifi/p2p/WifiP2pConfig.Builder#) | `https://developer.android.com/reference/kotlin/android/net/wifi/p2p/WifiP2pConfig.Builder#setGroupClientIpProvisioningMode(kotlin.Int)(groupClientIpProvisioningMode: https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)` Specify the IP provisioning mode when joining a group as a group client. |
| [WifiP2pConfig.Builder](https://developer.android.com/reference/kotlin/android/net/wifi/p2p/WifiP2pConfig.Builder#) | `https://developer.android.com/reference/kotlin/android/net/wifi/p2p/WifiP2pConfig.Builder#setGroupOperatingBand(kotlin.Int)(band: https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)` Specify the band to use for creating the group or joining the group. |
| [WifiP2pConfig.Builder](https://developer.android.com/reference/kotlin/android/net/wifi/p2p/WifiP2pConfig.Builder#) | `https://developer.android.com/reference/kotlin/android/net/wifi/p2p/WifiP2pConfig.Builder#setGroupOperatingFrequency(kotlin.Int)(frequency: https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)` Specify the frequency, in MHz, to use for creating the group or joining the group. |
| [WifiP2pConfig.Builder](https://developer.android.com/reference/kotlin/android/net/wifi/p2p/WifiP2pConfig.Builder#) | `https://developer.android.com/reference/kotlin/android/net/wifi/p2p/WifiP2pConfig.Builder#setNetworkName(kotlin.String)(networkName: https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)` Specify the network name, a. |
| [WifiP2pConfig.Builder](https://developer.android.com/reference/kotlin/android/net/wifi/p2p/WifiP2pConfig.Builder#) | `https://developer.android.com/reference/kotlin/android/net/wifi/p2p/WifiP2pConfig.Builder#setPairingBootstrappingConfig(android.net.wifi.p2p.WifiP2pPairingBootstrappingConfig)(config: https://developer.android.com/reference/kotlin/android/net/wifi/p2p/WifiP2pPairingBootstrappingConfig)` Set the pairing bootstrapping configuration for connecting using P2P pairing Protocol. |
| [WifiP2pConfig.Builder](https://developer.android.com/reference/kotlin/android/net/wifi/p2p/WifiP2pConfig.Builder#) | `https://developer.android.com/reference/kotlin/android/net/wifi/p2p/WifiP2pConfig.Builder#setPairingDiscoveryChannelFrequencyMhz(kotlin.Int)(frequencyMhz: https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)` Set the discovery channel frequency in MHz for pairing bootstrapping config method `https://developer.android.com/reference/kotlin/android/net/wifi/p2p/WifiP2pPairingBootstrappingConfig#PAIRING_BOOTSTRAPPING_METHOD_OUT_OF_BAND:kotlin.Int`. |
| [WifiP2pConfig.Builder](https://developer.android.com/reference/kotlin/android/net/wifi/p2p/WifiP2pConfig.Builder#) | `https://developer.android.com/reference/kotlin/android/net/wifi/p2p/WifiP2pConfig.Builder#setPassphrase(kotlin.String)(passphrase: https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)` Specify the passphrase for creating or joining a group. |
| [WifiP2pConfig.Builder](https://developer.android.com/reference/kotlin/android/net/wifi/p2p/WifiP2pConfig.Builder#) | `https://developer.android.com/reference/kotlin/android/net/wifi/p2p/WifiP2pConfig.Builder#setPccModeConnectionType(kotlin.Int)(connectionType: https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)` Specifies the PCC Mode connection type. |

## Public constructors

### Builder

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

```
Builder()
```

## Public methods

### build

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

```
fun build(): WifiP2pConfig
```

Build `https://developer.android.com/reference/kotlin/android/net/wifi/p2p/WifiP2pConfig` given the current requests made on the builder.

| Return ||
|---|---|
| `https://developer.android.com/reference/kotlin/android/net/wifi/p2p/WifiP2pConfig` | `https://developer.android.com/reference/kotlin/android/net/wifi/p2p/WifiP2pConfig` constructed based on builder method calls. This value cannot be `null`. |

### enablePersistentMode

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

```
fun enablePersistentMode(persistent: Boolean): WifiP2pConfig.Builder
```

Specify that the group configuration be persisted (i.e. saved). By default the group configuration will not be saved.

Optional. false by default.

| Parameters ||
|---|---|
| `persistent` | [Boolean](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html): is this group persistent group. |

| Return ||
|---|---|
| `https://developer.android.com/reference/kotlin/android/net/wifi/p2p/WifiP2pConfig.Builder#` | The builder to facilitate chaining `builder.setXXX(..).setXXX(..)`. This value cannot be `null`. |

### setAuthorizeConnectionFromPeerEnabled

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

```
fun setAuthorizeConnectionFromPeerEnabled(enabled: Boolean): WifiP2pConfig.Builder
```

Specify that the configuration is to authorize a connection request from a peer device. The MAC address of the peer device is specified using `https://developer.android.com/reference/kotlin/android/net/wifi/p2p/WifiP2pConfig.Builder#setDeviceAddress(android.net.MacAddress)`.

Optional. false by default. The default configuration is to join a group or to initiate a group formation.

This configuration is typically used in Bluetooth LE assisted P2P pairing protocol defined in Wi-Fi Direct R2 specification, section 3.9. The collocated Bluetooth Provider sends the pairing password to the peer device (Seeker) and direct the system to authorize the connection request from the peer device using `https://developer.android.com/reference/kotlin/android/net/wifi/p2p/WifiP2pManager#connect(android.net.wifi.p2p.WifiP2pManager.Channel,%20android.net.wifi.p2p.WifiP2pConfig,%20android.net.wifi.p2p.WifiP2pManager.ActionListener)`. The device will then wait for the connection request from the peer device.

| Parameters ||
|---|---|
| `enabled` | [Boolean](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html): true to authorize a connection request from the peer device, false to let the device join a group or form a group. |

| Return ||
|---|---|
| `https://developer.android.com/reference/kotlin/android/net/wifi/p2p/WifiP2pConfig.Builder#` | The builder to facilitate chaining `builder.setXXX(..).setXXX(..)`. This value cannot be `null`. |

### setDeviceAddress

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

```
fun setDeviceAddress(deviceAddress: MacAddress?): WifiP2pConfig.Builder
```

Specify the peer's MAC address. If not set, the device will try to find a peer whose SSID matches the network name as specified by `https://developer.android.com/reference/kotlin/android/net/wifi/p2p/WifiP2pConfig.Builder#setNetworkName(kotlin.String)`. Specifying null will reset the peer's MAC address to "02:00:00:00:00:00".

Optional. "02:00:00:00:00:00" by default.

If the network name is not set, the peer's MAC address is mandatory.

| Parameters ||
|---|---|
| `deviceAddress` | [MacAddress](https://developer.android.com/reference/kotlin/android/net/MacAddress.html#)?: the peer's MAC address. This value may be `null`. |

| Return ||
|---|---|
| `https://developer.android.com/reference/kotlin/android/net/wifi/p2p/WifiP2pConfig.Builder#` | The builder to facilitate chaining `builder.setXXX(..).setXXX(..)`. |

### setGroupClientIpProvisioningMode

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

```
fun setGroupClientIpProvisioningMode(groupClientIpProvisioningMode: Int): WifiP2pConfig.Builder
```

Specify the IP provisioning mode when joining a group as a group client. The IP provisioning mode should be `https://developer.android.com/reference/kotlin/android/net/wifi/p2p/WifiP2pConfig#GROUP_CLIENT_IP_PROVISIONING_MODE_IPV4_DHCP:kotlin.Int` or `https://developer.android.com/reference/kotlin/android/net/wifi/p2p/WifiP2pConfig#GROUP_CLIENT_IP_PROVISIONING_MODE_IPV6_LINK_LOCAL:kotlin.Int`.

When joining a group as group client using `https://developer.android.com/reference/kotlin/android/net/wifi/p2p/WifiP2pManager#connect(android.net.wifi.p2p.WifiP2pManager.Channel,%20android.net.wifi.p2p.WifiP2pConfig,%20android.net.wifi.p2p.WifiP2pManager.ActionListener)`, specifying `https://developer.android.com/reference/kotlin/android/net/wifi/p2p/WifiP2pConfig#GROUP_CLIENT_IP_PROVISIONING_MODE_IPV4_DHCP:kotlin.Int` directs the system to assign a IPv4 to the group client using DHCP. Specifying `https://developer.android.com/reference/kotlin/android/net/wifi/p2p/WifiP2pConfig#GROUP_CLIENT_IP_PROVISIONING_MODE_IPV6_LINK_LOCAL:kotlin.Int` directs the system to assign a link-local IPv6 to the group client.

Optional. `https://developer.android.com/reference/kotlin/android/net/wifi/p2p/WifiP2pConfig#GROUP_CLIENT_IP_PROVISIONING_MODE_IPV4_DHCP:kotlin.Int` by default.

If `https://developer.android.com/reference/kotlin/android/net/wifi/p2p/WifiP2pManager#isGroupOwnerIPv6LinkLocalAddressProvided()` is `true` and `https://developer.android.com/reference/kotlin/android/net/wifi/p2p/WifiP2pConfig#GROUP_CLIENT_IP_PROVISIONING_MODE_IPV6_LINK_LOCAL:kotlin.Int` is used then the system will discover the group owner's IPv6 link-local address and broadcast it using the `https://developer.android.com/reference/kotlin/android/net/wifi/p2p/WifiP2pManager#EXTRA_WIFI_P2P_INFO:kotlin.String` extra of the `https://developer.android.com/reference/kotlin/android/net/wifi/p2p/WifiP2pManager#WIFI_P2P_CONNECTION_CHANGED_ACTION:kotlin.String` broadcast. Otherwise, if `https://developer.android.com/reference/kotlin/android/net/wifi/p2p/WifiP2pManager#isGroupOwnerIPv6LinkLocalAddressProvided()` is `false` then the group owner's IPv6 link-local address is not discovered and it is the responsibility of the caller to obtain it in some other way, e.g. via out-of-band communication.

| Parameters ||
|---|---|
| `groupClientIpProvisioningMode` | [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html): the IP provisioning mode of the group client. This should be one of `https://developer.android.com/reference/kotlin/android/net/wifi/p2p/WifiP2pConfig#GROUP_CLIENT_IP_PROVISIONING_MODE_IPV4_DHCP:kotlin.Int`, `https://developer.android.com/reference/kotlin/android/net/wifi/p2p/WifiP2pConfig#GROUP_CLIENT_IP_PROVISIONING_MODE_IPV6_LINK_LOCAL:kotlin.Int`. Value is one of the following: - `https://developer.android.com/reference/kotlin/android/net/wifi/p2p/WifiP2pConfig#GROUP_CLIENT_IP_PROVISIONING_MODE_IPV4_DHCP:kotlin.Int` - `https://developer.android.com/reference/kotlin/android/net/wifi/p2p/WifiP2pConfig#GROUP_CLIENT_IP_PROVISIONING_MODE_IPV6_LINK_LOCAL:kotlin.Int` |

| Return ||
|---|---|
| `https://developer.android.com/reference/kotlin/android/net/wifi/p2p/WifiP2pConfig.Builder#` | The builder to facilitate chaining `builder.setXXX(..).setXXX(..)`. This value cannot be `null`. |

**See Also**

- `https://developer.android.com/reference/kotlin/android/net/wifi/p2p/WifiP2pManager#isGroupOwnerIPv6LinkLocalAddressProvided()`

### setGroupOperatingBand

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

```
fun setGroupOperatingBand(band: Int): WifiP2pConfig.Builder
```

Specify the band to use for creating the group or joining the group. The band should be `https://developer.android.com/reference/kotlin/android/net/wifi/p2p/WifiP2pConfig#GROUP_OWNER_BAND_2GHZ:kotlin.Int`, `https://developer.android.com/reference/kotlin/android/net/wifi/p2p/WifiP2pConfig#GROUP_OWNER_BAND_5GHZ:kotlin.Int` or `https://developer.android.com/reference/kotlin/android/net/wifi/p2p/WifiP2pConfig#GROUP_OWNER_BAND_6GHZ:kotlin.Int` or `https://developer.android.com/reference/kotlin/android/net/wifi/p2p/WifiP2pConfig#GROUP_OWNER_BAND_AUTO:kotlin.Int`.

When creating a group as Group Owner using `https://developer.android.com/reference/kotlin/android/net/wifi/p2p/WifiP2pManager#createGroup(android.net.wifi.p2p.WifiP2pManager.Channel,%20android.net.wifi.p2p.WifiP2pConfig,%20android.net.wifi.p2p.WifiP2pManager.ActionListener)`, specifying `https://developer.android.com/reference/kotlin/android/net/wifi/p2p/WifiP2pConfig#GROUP_OWNER_BAND_AUTO:kotlin.Int` allows the system to pick the operating frequency from all supported bands. Specifying `https://developer.android.com/reference/kotlin/android/net/wifi/p2p/WifiP2pConfig#GROUP_OWNER_BAND_2GHZ:kotlin.Int` or `https://developer.android.com/reference/kotlin/android/net/wifi/p2p/WifiP2pConfig#GROUP_OWNER_BAND_5GHZ:kotlin.Int` or `https://developer.android.com/reference/kotlin/android/net/wifi/p2p/WifiP2pConfig#GROUP_OWNER_BAND_6GHZ:kotlin.Int` only allows the system to pick the operating frequency in the specified band. If the Group Owner cannot create a group in the specified band, the operation will fail.

When joining a group as Group Client using `https://developer.android.com/reference/kotlin/android/net/wifi/p2p/WifiP2pManager#connect(android.net.wifi.p2p.WifiP2pManager.Channel,%20android.net.wifi.p2p.WifiP2pConfig,%20android.net.wifi.p2p.WifiP2pManager.ActionListener)`, specifying `https://developer.android.com/reference/kotlin/android/net/wifi/p2p/WifiP2pConfig#GROUP_OWNER_BAND_AUTO:kotlin.Int` allows the system to scan all supported frequencies to find the desired group. Specifying `https://developer.android.com/reference/kotlin/android/net/wifi/p2p/WifiP2pConfig#GROUP_OWNER_BAND_2GHZ:kotlin.Int` or `https://developer.android.com/reference/kotlin/android/net/wifi/p2p/WifiP2pConfig#GROUP_OWNER_BAND_5GHZ:kotlin.Int` or `https://developer.android.com/reference/kotlin/android/net/wifi/p2p/WifiP2pConfig#GROUP_OWNER_BAND_6GHZ:kotlin.Int` only allows the system to scan the specified band.

`https://developer.android.com/reference/kotlin/android/net/wifi/p2p/WifiP2pConfig.Builder#setGroupOperatingBand(kotlin.Int)` and `https://developer.android.com/reference/kotlin/android/net/wifi/p2p/WifiP2pConfig.Builder#setGroupOperatingFrequency(kotlin.Int)` are mutually exclusive. Setting operating band and frequency both is invalid.

Optional. `https://developer.android.com/reference/kotlin/android/net/wifi/p2p/WifiP2pConfig#GROUP_OWNER_BAND_AUTO:kotlin.Int` by default.

| Parameters ||
|---|---|
| `band` | [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html): the operating band of the group. This should be one of `https://developer.android.com/reference/kotlin/android/net/wifi/p2p/WifiP2pConfig#GROUP_OWNER_BAND_AUTO:kotlin.Int`, `https://developer.android.com/reference/kotlin/android/net/wifi/p2p/WifiP2pConfig#GROUP_OWNER_BAND_2GHZ:kotlin.Int`, `https://developer.android.com/reference/kotlin/android/net/wifi/p2p/WifiP2pConfig#GROUP_OWNER_BAND_5GHZ:kotlin.Int`, `https://developer.android.com/reference/kotlin/android/net/wifi/p2p/WifiP2pConfig#GROUP_OWNER_BAND_6GHZ:kotlin.Int`. Value is one of the following: - `https://developer.android.com/reference/kotlin/android/net/wifi/p2p/WifiP2pConfig#GROUP_OWNER_BAND_AUTO:kotlin.Int` - `https://developer.android.com/reference/kotlin/android/net/wifi/p2p/WifiP2pConfig#GROUP_OWNER_BAND_2GHZ:kotlin.Int` - `https://developer.android.com/reference/kotlin/android/net/wifi/p2p/WifiP2pConfig#GROUP_OWNER_BAND_5GHZ:kotlin.Int` - `https://developer.android.com/reference/kotlin/android/net/wifi/p2p/WifiP2pConfig#GROUP_OWNER_BAND_6GHZ:kotlin.Int` |

| Return ||
|---|---|
| `https://developer.android.com/reference/kotlin/android/net/wifi/p2p/WifiP2pConfig.Builder#` | The builder to facilitate chaining `builder.setXXX(..).setXXX(..)`. This value cannot be `null`. |

### setGroupOperatingFrequency

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

```
fun setGroupOperatingFrequency(frequency: Int): WifiP2pConfig.Builder
```

Specify the frequency, in MHz, to use for creating the group or joining the group.

When creating a group as Group Owner using `https://developer.android.com/reference/kotlin/android/net/wifi/p2p/WifiP2pManager#createGroup(android.net.wifi.p2p.WifiP2pManager.Channel,%20android.net.wifi.p2p.WifiP2pConfig,%20android.net.wifi.p2p.WifiP2pManager.ActionListener)`, specifying a frequency only allows the system to pick the specified frequency. If the Group Owner cannot create a group at the specified frequency, the operation will fail. When not specifying a frequency, it allows the system to pick operating frequency from all supported bands.

When joining a group as Group Client using `https://developer.android.com/reference/kotlin/android/net/wifi/p2p/WifiP2pManager#connect(android.net.wifi.p2p.WifiP2pManager.Channel,%20android.net.wifi.p2p.WifiP2pConfig,%20android.net.wifi.p2p.WifiP2pManager.ActionListener)`, specifying a frequency only allows the system to scan the specified frequency. If the frequency is not supported or invalid, the operation will fail. When not specifying a frequency, it allows the system to scan all supported frequencies to find the desired group.

`https://developer.android.com/reference/kotlin/android/net/wifi/p2p/WifiP2pConfig.Builder#setGroupOperatingBand(kotlin.Int)` and `https://developer.android.com/reference/kotlin/android/net/wifi/p2p/WifiP2pConfig.Builder#setGroupOperatingFrequency(kotlin.Int)` are mutually exclusive. Setting operating band and frequency both is invalid.

Optional. 0 by default.

| Parameters ||
|---|---|
| `frequency` | [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html): the operating frequency of the group. |

| Return ||
|---|---|
| `https://developer.android.com/reference/kotlin/android/net/wifi/p2p/WifiP2pConfig.Builder#` | The builder to facilitate chaining `builder.setXXX(..).setXXX(..)`. This value cannot be `null`. |

### setNetworkName

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

```
fun setNetworkName(networkName: String): WifiP2pConfig.Builder
```

Specify the network name, a.k.a. group name, for creating or joining a group.

A network name shall begin with "DIRECT-xy". x and y are selected from the following character set: upper case letters, lower case letters and numbers. Any byte values allowed for an SSID according to IEEE802.11-2012 \[1\] may be included after the string "DIRECT-xy" (including none).

Must be called - an empty network name or an network name not conforming to the P2P Group ID naming rule is not valid.

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

| Return ||
|---|---|
| `https://developer.android.com/reference/kotlin/android/net/wifi/p2p/WifiP2pConfig.Builder#` | The builder to facilitate chaining `builder.setXXX(..).setXXX(..)`. This value cannot be `null`. |

### setPairingBootstrappingConfig

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

```
fun setPairingBootstrappingConfig(config: WifiP2pPairingBootstrappingConfig): WifiP2pConfig.Builder
```

Set the pairing bootstrapping configuration for connecting using P2P pairing Protocol.

| Parameters ||
|---|---|
| `config` | [WifiP2pPairingBootstrappingConfig](https://developer.android.com/reference/kotlin/android/net/wifi/p2p/WifiP2pPairingBootstrappingConfig): See `https://developer.android.com/reference/kotlin/android/net/wifi/p2p/WifiP2pPairingBootstrappingConfig` This value cannot be `null`. |

| Return ||
|---|---|
| `https://developer.android.com/reference/kotlin/android/net/wifi/p2p/WifiP2pConfig.Builder#` | The builder to facilitate chaining `builder.setXXX(..).setXXX(..)`. This value cannot be `null`. |

### setPairingDiscoveryChannelFrequencyMhz

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

```
fun setPairingDiscoveryChannelFrequencyMhz(frequencyMhz: Int): WifiP2pConfig.Builder
```

Set the discovery channel frequency in MHz for pairing bootstrapping config method `https://developer.android.com/reference/kotlin/android/net/wifi/p2p/WifiP2pPairingBootstrappingConfig#PAIRING_BOOTSTRAPPING_METHOD_OUT_OF_BAND:kotlin.Int`.

| Parameters ||
|---|---|
| `frequencyMhz` | [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html): The channel frequency in MHz. |

| Return ||
|---|---|
| `https://developer.android.com/reference/kotlin/android/net/wifi/p2p/WifiP2pConfig.Builder#` | The builder to facilitate chaining `builder.setXXX(..).setXXX(..)`. This value cannot be `null`. |

### setPassphrase

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

```
fun setPassphrase(passphrase: String): WifiP2pConfig.Builder
```

Specify the passphrase for creating or joining a group.

The passphrase must be an ASCII string whose length is, 1. Between 8 and 63 for `https://developer.android.com/reference/kotlin/android/net/wifi/p2p/WifiP2pConfig#PCC_MODE_CONNECTION_TYPE_LEGACY_ONLY:kotlin.Int` and `https://developer.android.com/reference/kotlin/android/net/wifi/p2p/WifiP2pConfig#PCC_MODE_CONNECTION_TYPE_LEGACY_OR_R2:kotlin.Int`. 2. Less than 128 for `https://developer.android.com/reference/kotlin/android/net/wifi/p2p/WifiP2pConfig#PCC_MODE_CONNECTION_TYPE_R2_ONLY:kotlin.Int`.

Must be called - an empty passphrase is not valid.

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

| Return ||
|---|---|
| `https://developer.android.com/reference/kotlin/android/net/wifi/p2p/WifiP2pConfig.Builder#` | The builder to facilitate chaining `builder.setXXX(..).setXXX(..)`. This value cannot be `null`. |

### setPccModeConnectionType

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

```
fun setPccModeConnectionType(connectionType: Int): WifiP2pConfig.Builder
```

Specifies the PCC Mode connection type.

| Parameters ||
|---|---|
| `connectionType` | [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html): One of the `PCC_MODE_CONNECTION_TYPE_*`. Value is one of the following: - `https://developer.android.com/reference/kotlin/android/net/wifi/p2p/WifiP2pConfig#PCC_MODE_CONNECTION_TYPE_LEGACY_ONLY:kotlin.Int` - `https://developer.android.com/reference/kotlin/android/net/wifi/p2p/WifiP2pConfig#PCC_MODE_CONNECTION_TYPE_LEGACY_OR_R2:kotlin.Int` - `https://developer.android.com/reference/kotlin/android/net/wifi/p2p/WifiP2pConfig#PCC_MODE_CONNECTION_TYPE_R2_ONLY:kotlin.Int` |

| Return ||
|---|---|
| `https://developer.android.com/reference/kotlin/android/net/wifi/p2p/WifiP2pConfig.Builder#` | Builder for chaining. This value cannot be `null`. |

| Exceptions ||
|---|---|
| `java.lang.IllegalArgumentException` | when the connectionType is invalid. |