Added in API level 14

WifiP2pConfig


open class WifiP2pConfig : Parcelable
kotlin.Any
   ↳ android.net.wifi.p2p.WifiP2pConfig

A class representing a Wi-Fi P2p configuration for setting up a connection {@see WifiP2pManager}

Summary

Nested classes

Builder used to build WifiP2pConfig objects for creating or joining a group.

Constants
static Int

IP provisioning via IPv4 DHCP, when joining a group as a group client.

static Int

IP provisioning via IPv6 link-local, when joining a group as a group client.

static Int

Allow the system to pick the operating frequency from the 2.

static Int

Allow the system to pick the operating frequency from the 5 GHz band.

static Int

Allow the system to pick the operating frequency from the 6 GHz band.

static Int

Allow the system to pick the operating frequency from all supported bands.

static Int

The system can choose an appropriate owner intent value, to be filled in the field groupOwnerIntent.

static Int

The most inclination to be a group owner, to be filled in the field groupOwnerIntent.

static Int

The least inclination to be a group owner, to be filled in the field groupOwnerIntent.

static Int

P2P Protocol version 1

static Int

P2P Protocol version 2

static Int

Legacy connection type.

static Int

Wi-Fi Direct R1/R2 compatible mode connection type.

static Int

This configuration allows only Wi-Fi Direct R2 supported devices to establish connection.

Inherited constants
Public constructors

copy constructor

Public methods
open Int

Implement the Parcelable interface

open Int

Get the IP provisioning mode when joining a group as a group client.

open Int

Get the required band for the group owner.

open Int

Get the P2P Group Owner version.

open Int

Get the network ID of this P2P configuration.

open String?

Get the network name of this P2P configuration, or null if unset.

open WifiP2pPairingBootstrappingConfig?

Get the pairing bootstrapping configuration , or null if unset.

open String?

Get the passphrase of this P2P configuration, or null if unset.

open Int

Get the PCC Mode connection type.

open Unit

Set the P2P Group Owner version.

open String

open Unit
writeToParcel(dest: Parcel, flags: Int)

Implement the Parcelable interface

Properties
static Parcelable.Creator<WifiP2pConfig!>

Implement the Parcelable interface

String!

The device MAC address uniquely identifies a Wi-Fi p2p device

Int

This is an integer value between GROUP_OWNER_INTENT_MIN and GROUP_OWNER_INTENT_MAX where GROUP_OWNER_INTENT_MIN indicates the least inclination to be a group owner and GROUP_OWNER_INTENT_MAX indicates the highest inclination to be a group owner.

WpsInfo!

Wi-Fi Protected Setup information

Constants

GROUP_CLIENT_IP_PROVISIONING_MODE_IPV4_DHCP

Added in API level 34
static val GROUP_CLIENT_IP_PROVISIONING_MODE_IPV4_DHCP: Int

IP provisioning via IPv4 DHCP, when joining a group as a group client.

Value: 0
Added in API level 34
static val GROUP_CLIENT_IP_PROVISIONING_MODE_IPV6_LINK_LOCAL: Int

IP provisioning via IPv6 link-local, when joining a group as a group client.

Value: 1

GROUP_OWNER_BAND_2GHZ

Added in API level 29
static val GROUP_OWNER_BAND_2GHZ: Int

Allow the system to pick the operating frequency from the 2.4 GHz band.

Value: 1

GROUP_OWNER_BAND_5GHZ

Added in API level 29
static val GROUP_OWNER_BAND_5GHZ: Int

Allow the system to pick the operating frequency from the 5 GHz band.

Value: 2

GROUP_OWNER_BAND_6GHZ

static val GROUP_OWNER_BAND_6GHZ: Int

Allow the system to pick the operating frequency from the 6 GHz band.

Value: 3

GROUP_OWNER_BAND_AUTO

Added in API level 29
static val GROUP_OWNER_BAND_AUTO: Int

Allow the system to pick the operating frequency from all supported bands.

Value: 0

GROUP_OWNER_INTENT_AUTO

Added in API level 30
static val GROUP_OWNER_INTENT_AUTO: Int

The system can choose an appropriate owner intent value, to be filled in the field groupOwnerIntent.

Value: -1

GROUP_OWNER_INTENT_MAX

Added in API level 30
static val GROUP_OWNER_INTENT_MAX: Int

The most inclination to be a group owner, to be filled in the field groupOwnerIntent.

Value: 15

GROUP_OWNER_INTENT_MIN

Added in API level 30
static val GROUP_OWNER_INTENT_MIN: Int

The least inclination to be a group owner, to be filled in the field groupOwnerIntent.

Value: 0

P2P_VERSION_1

static val P2P_VERSION_1: Int

P2P Protocol version 1

Value: 0

P2P_VERSION_2

static val P2P_VERSION_2: Int

P2P Protocol version 2

Value: 1

PCC_MODE_CONNECTION_TYPE_LEGACY_ONLY

static val PCC_MODE_CONNECTION_TYPE_LEGACY_ONLY: Int

Legacy connection type.

Group Owner: Configured to support WPA2-Personal connections.

Group Client: Configured to connect to Group Owner using WPA2-Personal.

Value: 0

PCC_MODE_CONNECTION_TYPE_LEGACY_OR_R2

static val PCC_MODE_CONNECTION_TYPE_LEGACY_OR_R2: Int

Wi-Fi Direct R1/R2 compatible mode connection type.

Group Owner: Configured in WPA3-Personal Compatibility Mode to support WPA3-Personal and WPA2-Personal connections simultaneously.

Group Client: Configured to connect to Group Owner using WPA3-Personal or WPA2-Personal. The system will choose WPA3-Personal if Group Owner support WPA3-Personal.

Value: 1

PCC_MODE_CONNECTION_TYPE_R2_ONLY

static val PCC_MODE_CONNECTION_TYPE_R2_ONLY: Int

This configuration allows only Wi-Fi Direct R2 supported devices to establish connection.

Group Owner: Configured to support WPA3-Personal connections.

Group Client: Configured to connect to Group Owner using WPA3-Personal.

Value: 2

Public constructors

WifiP2pConfig

Added in API level 14
WifiP2pConfig()

WifiP2pConfig

Added in API level 14
WifiP2pConfig(source: WifiP2pConfig!)

copy constructor

Public methods

describeContents

Added in API level 14
open fun describeContents(): Int

Implement the Parcelable interface

Return
Int a bitmask indicating the set of special object types marshaled by this Parcelable object instance. Value is either 0 or android.os.Parcelable#CONTENTS_FILE_DESCRIPTOR

getGroupClientIpProvisioningMode

Added in API level 34
open fun getGroupClientIpProvisioningMode(): Int

Get the IP provisioning mode when joining a group as a group client. The result will be one of the following: GROUP_CLIENT_IP_PROVISIONING_MODE_IPV4_DHCP, GROUP_CLIENT_IP_PROVISIONING_MODE_IPV6_LINK_LOCAL

Return
Int Value is android.net.wifi.p2p.WifiP2pConfig#GROUP_CLIENT_IP_PROVISIONING_MODE_IPV4_DHCP, or android.net.wifi.p2p.WifiP2pConfig#GROUP_CLIENT_IP_PROVISIONING_MODE_IPV6_LINK_LOCAL

getGroupOwnerVersion

open fun getGroupOwnerVersion(): Int

Get the P2P Group Owner version. See also setGroupOwnerVersion(int).

Return
Int The P2P Group Owner protocol version. Value is android.net.wifi.p2p.WifiP2pConfig.P2P_DEFAULT_VERSION_1, android.net.wifi.p2p.WifiP2pConfig#P2P_VERSION_1, or android.net.wifi.p2p.WifiP2pConfig#P2P_VERSION_2

getNetworkId

Added in API level 30
open fun getNetworkId(): Int

Get the network ID of this P2P configuration.

Return
Int either a non-negative network ID, or one of WifiP2pGroup.NETWORK_ID_PERSISTENT or WifiP2pGroup.NETWORK_ID_TEMPORARY.

getNetworkName

Added in API level 30
open fun getNetworkName(): String?

Get the network name of this P2P configuration, or null if unset.

getPairingBootstrappingConfig

open fun getPairingBootstrappingConfig(): WifiP2pPairingBootstrappingConfig?

Get the pairing bootstrapping configuration , or null if unset.

getPassphrase

Added in API level 30
open fun getPassphrase(): String?

Get the passphrase of this P2P configuration, or null if unset.

getPccModeConnectionType

open fun getPccModeConnectionType(): Int

Get the PCC Mode connection type.

Return
Int One of the PCC_MODE_CONNECTION_TYPE_*. Value is android.net.wifi.p2p.WifiP2pConfig.PCC_MODE_DEFAULT_CONNECTION_TYPE_LEGACY_ONLY, android.net.wifi.p2p.WifiP2pConfig#PCC_MODE_CONNECTION_TYPE_LEGACY_ONLY, android.net.wifi.p2p.WifiP2pConfig#PCC_MODE_CONNECTION_TYPE_LEGACY_OR_R2, or android.net.wifi.p2p.WifiP2pConfig#PCC_MODE_CONNECTION_TYPE_R2_ONLY

setGroupOwnerVersion

open fun setGroupOwnerVersion(version: Int): Unit

Set the P2P Group Owner version.

Parameters
version Int: The P2P Group Owner protocol version. Value is android.net.wifi.p2p.WifiP2pConfig.P2P_DEFAULT_VERSION_1, android.net.wifi.p2p.WifiP2pConfig#P2P_VERSION_1, or android.net.wifi.p2p.WifiP2pConfig#P2P_VERSION_2

toString

Added in API level 14
open fun toString(): String
Return
String a string representation of the object.

writeToParcel

Added in API level 14
open fun writeToParcel(
    dest: Parcel,
    flags: Int
): Unit

Implement the Parcelable interface

Parameters
dest Parcel: The Parcel in which the object should be written. This value cannot be null.
flags Int: Additional flags about how the object should be written. May be 0 or PARCELABLE_WRITE_RETURN_VALUE. Value is either 0 or a combination of android.os.Parcelable#PARCELABLE_WRITE_RETURN_VALUE, and android.os.Parcelable.PARCELABLE_ELIDE_DUPLICATES

Properties

CREATOR

Added in API level 14
static val CREATOR: Parcelable.Creator<WifiP2pConfig!>

Implement the Parcelable interface

deviceAddress

Added in API level 14
var deviceAddress: String!

The device MAC address uniquely identifies a Wi-Fi p2p device

groupOwnerIntent

Added in API level 14
var groupOwnerIntent: Int

This is an integer value between GROUP_OWNER_INTENT_MIN and GROUP_OWNER_INTENT_MAX where GROUP_OWNER_INTENT_MIN indicates the least inclination to be a group owner and GROUP_OWNER_INTENT_MAX indicates the highest inclination to be a group owner. A value of GROUP_OWNER_INTENT_AUTO indicates the system can choose an appropriate value. By default this field is set to GROUP_OWNER_INTENT_AUTO.
Value is between 0 and 15 inclusive

wps

Added in API level 14
var wps: WpsInfo!

Wi-Fi Protected Setup information