Added in [API level 29](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels) Summary: [Ctors](https://developer.android.com/reference/android/net/wifi/p2p/WifiP2pConfig.Builder#pubctors) \| [Methods](https://developer.android.com/reference/android/net/wifi/p2p/WifiP2pConfig.Builder#pubmethods) \| [Inherited Methods](https://developer.android.com/reference/android/net/wifi/p2p/WifiP2pConfig.Builder#inhmethods)

# WifiP2pConfig.Builder

*** ** * ** ***


`
public
static
final

class
WifiP2pConfig.Builder
`


`

extends https://developer.android.com/reference/java/lang/Object


`

`


`

|---|---|
| [java.lang.Object](https://developer.android.com/reference/java/lang/Object) ||
| ↳ | android.net.wifi.p2p.WifiP2pConfig.Builder |

<br />

*** ** * ** ***

Builder used to build `https://developer.android.com/reference/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/android/net/wifi/p2p/WifiP2pConfig.Builder#setNetworkName(java.lang.String)` and `https://developer.android.com/reference/android/net/wifi/p2p/WifiP2pConfig.Builder#setPassphrase(java.lang.String)`.
- SSID or Passphrase is unknown, in such a case the MAC address must be known and specified using `https://developer.android.com/reference/android/net/wifi/p2p/WifiP2pConfig.Builder#setDeviceAddress(android.net.MacAddress)`.

<br />

## Summary

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

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

| ### Inherited methods |
|---|---|
| From class ` https://developer.android.com/reference/java/lang/Object ` |---|---| | ` https://developer.android.com/reference/java/lang/Object` | ` https://developer.android.com/reference/java/lang/Object#clone()() ` Creates and returns a copy of this object. | | ` boolean` | ` https://developer.android.com/reference/java/lang/Object#equals(java.lang.Object)(https://developer.android.com/reference/java/lang/Object obj) ` Indicates whether some other object is "equal to" this one. | | ` void` | ` https://developer.android.com/reference/java/lang/Object#finalize()() ` Called by the garbage collector on an object when garbage collection determines that there are no more references to the object. | | ` final https://developer.android.com/reference/java/lang/Class<?>` | ` https://developer.android.com/reference/java/lang/Object#getClass()() ` Returns the runtime class of this `Object`. | | ` int` | ` https://developer.android.com/reference/java/lang/Object#hashCode()() ` Returns a hash code value for the object. | | ` final void` | ` https://developer.android.com/reference/java/lang/Object#notify()() ` Wakes up a single thread that is waiting on this object's monitor. | | ` final void` | ` https://developer.android.com/reference/java/lang/Object#notifyAll()() ` Wakes up all threads that are waiting on this object's monitor. | | ` https://developer.android.com/reference/java/lang/String` | ` https://developer.android.com/reference/java/lang/Object#toString()() ` Returns a string representation of the object. | | ` final void` | ` https://developer.android.com/reference/java/lang/Object#wait(long,%20int)(long timeoutMillis, int nanos) ` Causes the current thread to wait until it is awakened, typically by being *notified* or *interrupted*, or until a certain amount of real time has elapsed. | | ` final void` | ` https://developer.android.com/reference/java/lang/Object#wait(long)(long timeoutMillis) ` Causes the current thread to wait until it is awakened, typically by being *notified* or *interrupted*, or until a certain amount of real time has elapsed. | | ` final void` | ` https://developer.android.com/reference/java/lang/Object#wait()() ` Causes the current thread to wait until it is awakened, typically by being *notified* or *interrupted*. | ||

## Public constructors

### Builder

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

```
public Builder ()
```

<br />

<br />

## Public methods

### build

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

```
public WifiP2pConfig build ()
```

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

<br />

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

### enablePersistentMode

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

```
public WifiP2pConfig.Builder enablePersistentMode (boolean persistent)
```

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


Optional. false by default.

<br />

| Parameters ||
|---|---|
| `persistent` | `boolean`: is this group persistent group. <br /> |

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

### setAuthorizeConnectionFromPeerEnabled

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

```
public WifiP2pConfig.Builder setAuthorizeConnectionFromPeerEnabled (boolean enabled)
```

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/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/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.

<br />

| Parameters ||
|---|---|
| `enabled` | `boolean`: true to authorize a connection request from the peer device, false to let the device join a group or form a group. <br /> |

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

### setDeviceAddress

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

```
public WifiP2pConfig.Builder setDeviceAddress (MacAddress deviceAddress)
```

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/android/net/wifi/p2p/WifiP2pConfig.Builder#setNetworkName(java.lang.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.

<br />

| Parameters ||
|---|---|
| `deviceAddress` | `MacAddress`: the peer's MAC address. This value may be `null`. <br /> |

| Returns ||
|---|---|
| `https://developer.android.com/reference/android/net/wifi/p2p/WifiP2pConfig.Builder` | The builder to facilitate chaining `builder.setXXX(..).setXXX(..)`. <br /> |

### setGroupClientIpProvisioningMode

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

```
public WifiP2pConfig.Builder setGroupClientIpProvisioningMode (int groupClientIpProvisioningMode)
```

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


When joining a group as group client using `https://developer.android.com/reference/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/android/net/wifi/p2p/WifiP2pConfig#GROUP_CLIENT_IP_PROVISIONING_MODE_IPV4_DHCP` directs the system to
assign a IPv4 to the group client using DHCP. Specifying
`https://developer.android.com/reference/android/net/wifi/p2p/WifiP2pConfig#GROUP_CLIENT_IP_PROVISIONING_MODE_IPV6_LINK_LOCAL` directs the system to assign
a link-local IPv6 to the group client.


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


If `https://developer.android.com/reference/android/net/wifi/p2p/WifiP2pManager#isGroupOwnerIPv6LinkLocalAddressProvided()` is `true` and
`https://developer.android.com/reference/android/net/wifi/p2p/WifiP2pConfig#GROUP_CLIENT_IP_PROVISIONING_MODE_IPV6_LINK_LOCAL` 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/android/net/wifi/p2p/WifiP2pManager#EXTRA_WIFI_P2P_INFO` extra of the
`https://developer.android.com/reference/android/net/wifi/p2p/WifiP2pManager#WIFI_P2P_CONNECTION_CHANGED_ACTION` broadcast. Otherwise, if
`https://developer.android.com/reference/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.

<br />

| Parameters ||
|---|---|
| `groupClientIpProvisioningMode` | `int`: the IP provisioning mode of the group client. This should be one of `https://developer.android.com/reference/android/net/wifi/p2p/WifiP2pConfig#GROUP_CLIENT_IP_PROVISIONING_MODE_IPV4_DHCP`, `https://developer.android.com/reference/android/net/wifi/p2p/WifiP2pConfig#GROUP_CLIENT_IP_PROVISIONING_MODE_IPV6_LINK_LOCAL`. Value is one of the following: - `https://developer.android.com/reference/android/net/wifi/p2p/WifiP2pConfig#GROUP_CLIENT_IP_PROVISIONING_MODE_IPV4_DHCP` - `https://developer.android.com/reference/android/net/wifi/p2p/WifiP2pConfig#GROUP_CLIENT_IP_PROVISIONING_MODE_IPV6_LINK_LOCAL` |

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

**See also:**

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

### setGroupOperatingBand

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

```
public WifiP2pConfig.Builder setGroupOperatingBand (int band)
```

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


When creating a group as Group Owner using `https://developer.android.com/reference/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/android/net/wifi/p2p/WifiP2pConfig#GROUP_OWNER_BAND_AUTO` allows the system to pick the operating
frequency from all supported bands.
Specifying `https://developer.android.com/reference/android/net/wifi/p2p/WifiP2pConfig#GROUP_OWNER_BAND_2GHZ` or `https://developer.android.com/reference/android/net/wifi/p2p/WifiP2pConfig#GROUP_OWNER_BAND_5GHZ` or
`https://developer.android.com/reference/android/net/wifi/p2p/WifiP2pConfig#GROUP_OWNER_BAND_6GHZ`
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/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/android/net/wifi/p2p/WifiP2pConfig#GROUP_OWNER_BAND_AUTO` allows the system to scan all supported
frequencies to find the desired group. Specifying `https://developer.android.com/reference/android/net/wifi/p2p/WifiP2pConfig#GROUP_OWNER_BAND_2GHZ` or
`https://developer.android.com/reference/android/net/wifi/p2p/WifiP2pConfig#GROUP_OWNER_BAND_5GHZ` or `https://developer.android.com/reference/android/net/wifi/p2p/WifiP2pConfig#GROUP_OWNER_BAND_6GHZ` only allows the
system to scan the specified band.


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


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

<br />

| Parameters ||
|---|---|
| `band` | `int`: the operating band of the group. This should be one of `https://developer.android.com/reference/android/net/wifi/p2p/WifiP2pConfig#GROUP_OWNER_BAND_AUTO`, `https://developer.android.com/reference/android/net/wifi/p2p/WifiP2pConfig#GROUP_OWNER_BAND_2GHZ`, `https://developer.android.com/reference/android/net/wifi/p2p/WifiP2pConfig#GROUP_OWNER_BAND_5GHZ`, `https://developer.android.com/reference/android/net/wifi/p2p/WifiP2pConfig#GROUP_OWNER_BAND_6GHZ`. Value is one of the following: - `https://developer.android.com/reference/android/net/wifi/p2p/WifiP2pConfig#GROUP_OWNER_BAND_AUTO` - `https://developer.android.com/reference/android/net/wifi/p2p/WifiP2pConfig#GROUP_OWNER_BAND_2GHZ` - `https://developer.android.com/reference/android/net/wifi/p2p/WifiP2pConfig#GROUP_OWNER_BAND_5GHZ` - `https://developer.android.com/reference/android/net/wifi/p2p/WifiP2pConfig#GROUP_OWNER_BAND_6GHZ` |

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

### setGroupOperatingFrequency

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

```
public WifiP2pConfig.Builder setGroupOperatingFrequency (int frequency)
```

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/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/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/android/net/wifi/p2p/WifiP2pConfig.Builder#setGroupOperatingBand(int)` and `https://developer.android.com/reference/android/net/wifi/p2p/WifiP2pConfig.Builder#setGroupOperatingFrequency(int)` are
mutually exclusive. Setting operating band and frequency both is invalid.


Optional. 0 by default.

<br />

| Parameters ||
|---|---|
| `frequency` | `int`: the operating frequency of the group. <br /> |

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

### setNetworkName

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

```
public WifiP2pConfig.Builder setNetworkName (String networkName)
```

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.

<br />

| Parameters ||
|---|---|
| `networkName` | `String`: network name of a group. This value cannot be `null`. <br /> |

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

### setPairingBootstrappingConfig

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

```
public WifiP2pConfig.Builder setPairingBootstrappingConfig (WifiP2pPairingBootstrappingConfig config)
```

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

<br />

| Parameters ||
|---|---|
| `config` | `WifiP2pPairingBootstrappingConfig`: See `https://developer.android.com/reference/android/net/wifi/p2p/WifiP2pPairingBootstrappingConfig` This value cannot be `null`. <br /> |

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

### setPairingDiscoveryChannelFrequencyMhz

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

```
public WifiP2pConfig.Builder setPairingDiscoveryChannelFrequencyMhz (int frequencyMhz)
```

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

<br />

| Parameters ||
|---|---|
| `frequencyMhz` | `int`: The channel frequency in MHz. <br /> |

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

### setPassphrase

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

```
public WifiP2pConfig.Builder setPassphrase (String passphrase)
```

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/android/net/wifi/p2p/WifiP2pConfig#PCC_MODE_CONNECTION_TYPE_LEGACY_ONLY` and
`https://developer.android.com/reference/android/net/wifi/p2p/WifiP2pConfig#PCC_MODE_CONNECTION_TYPE_LEGACY_OR_R2`.
2. Less than 128 for `https://developer.android.com/reference/android/net/wifi/p2p/WifiP2pConfig#PCC_MODE_CONNECTION_TYPE_R2_ONLY`.


Must be called - an empty passphrase is not valid.

<br />

| Parameters ||
|---|---|
| `passphrase` | `String`: the passphrase of a group. This value cannot be `null`. <br /> |

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

### setPccModeConnectionType

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

```
public WifiP2pConfig.Builder setPccModeConnectionType (int connectionType)
```

Specifies the PCC Mode connection type.

<br />

| Parameters ||
|---|---|
| `connectionType` | `int`: One of the `PCC_MODE_CONNECTION_TYPE_*`. Value is one of the following: - `https://developer.android.com/reference/android/net/wifi/p2p/WifiP2pConfig#PCC_MODE_CONNECTION_TYPE_LEGACY_ONLY` - `https://developer.android.com/reference/android/net/wifi/p2p/WifiP2pConfig#PCC_MODE_CONNECTION_TYPE_LEGACY_OR_R2` - `https://developer.android.com/reference/android/net/wifi/p2p/WifiP2pConfig#PCC_MODE_CONNECTION_TYPE_R2_ONLY` |

| Returns ||
|---|---|
| `https://developer.android.com/reference/android/net/wifi/p2p/WifiP2pConfig.Builder` | Builder for chaining. This value cannot be `null`. <br /> |

| Throws ||
|---|---|
| `https://developer.android.com/reference/java/lang/IllegalArgumentException` | when the connectionType is invalid. |