Added in API level 1
Deprecated in API level 29

WifiConfiguration


open class WifiConfiguration : Parcelable
kotlin.Any
   ↳ android.net.wifi.WifiConfiguration

A class representing a configured Wi-Fi network, including the security configuration.

Summary

Nested classes
open

Recognized IEEE 802.

open

Recognized group ciphers.

open

Recognized group management ciphers.

open

Recognized key management schemes.

open

Recognized pairwise ciphers for WPA.

open

Recognized security protocols.

open

Possible status of a network configuration.

Constants
static Int

Let the wifi framework automatically decide the MAC randomization strategy.

static Int

Use factory MAC when connecting to this network

static Int

Use a randomly generated MAC address for connections to this network.

static Int

Generate a randomized MAC once and reuse it for all connections to this network

static Int

Security type for Easy Connect (DPP) network

static Int

Security type for an EAP network.

static Int

Security type for a WPA3-Enterprise in 192-bit security network.

static Int

Security type for a WPA3-Enterprise network.

static Int

Security type for a WPA3-Enterprise in 192-bit security network.

static Int

Security type for an open network.

static Int

Security type for an OWE network.

static Int

Security type for a PSK network.

static Int

Security type for an SAE network.

static Int

Security type for a WAPI Certificate network.

static Int

Security type for a WAPI PSK network.

static Int

Security type for a WEP network.

Inherited constants
Public constructors

Copy constructor

Public methods
open Int

Implement the Parcelable interface {@hide}

open ProxyInfo!

Returns the HTTP proxy used by this object.

open String

Return a String that can be used to uniquely identify this WifiConfiguration.

open Int

Get the MAC randomization setting for this network.

open MacAddress

Returns MAC address set to be the local randomized MAC address.

open Boolean

To check if this WifiConfiguration supports configuring a peer Enrollee device with SECURITY_TYPE_DPP

open Boolean

Identify if this configuration represents a Passpoint network

open Unit
setHttpProxy(httpProxy: ProxyInfo!)

Set the ProxyInfo for this WifiConfiguration.

open Unit

Set the IpConfiguration for this network.

open Unit
setMacRandomizationSetting(macRandomizationSetting: Int)

Set the MAC randomization setting for this network.

open Unit
setSecurityParams(securityType: Int)

Set the various security params to correspond to the provided security type.

open String

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

Implement the Parcelable interface {@hide}

Properties
String!

When set, this network configuration entry should only be used when associating with the AP having the specified BSSID.

String!

Fully qualified domain name of a Passpoint configuration

String!

The network's SSID.

BitSet

The set of authentication protocols supported by this configuration.

BitSet

The set of group ciphers supported by this configuration.

BitSet

The set of group management ciphers supported by this configuration.

BitSet

The set of key management protocols supported by this configuration.

BitSet

The set of pairwise ciphers for WPA supported by this configuration.

BitSet

The set of security protocols supported by this configuration.

BitSet

The set of SuiteB ciphers supported by this configuration.

WifiEnterpriseConfig!

The enterprise configuration details specifying the EAP method, certificates and other settings associated with the EAP.

Boolean

This is a network that does not broadcast its SSID, so an SSID-specific probe request must be used for scans.

Boolean

Flag indicating if this network is provided by a home Passpoint provider or a roaming Passpoint provider.

Int

The ID number that the supplicant uses to identify this network configuration entry.

String!

Pre-shared key for use with WPA-PSK.

Int

Priority determines the preference given to a network by wpa_supplicant when choosing an access point with which to associate.

String!

Name of Passpoint credential provider

LongArray!

Roaming Consortium Id list for Passpoint credential; identifies a set of networks where Passpoint credential will be considered valid

Int

The current status of this network configuration entry.

Array<String!>!

Four WEP keys.

Int

Default WEP key index, ranging from 0 to 3.

Constants

RANDOMIZATION_AUTO

Added in API level 33
Deprecated in API level 29
static val RANDOMIZATION_AUTO: Int

Deprecated: Deprecated in Java.

Let the wifi framework automatically decide the MAC randomization strategy.

Value: 3

RANDOMIZATION_NONE

Added in API level 33
Deprecated in API level 29
static val RANDOMIZATION_NONE: Int

Deprecated: Deprecated in Java.

Use factory MAC when connecting to this network

Value: 0

RANDOMIZATION_NON_PERSISTENT

Added in API level 33
Deprecated in API level 29
static val RANDOMIZATION_NON_PERSISTENT: Int

Deprecated: Deprecated in Java.

Use a randomly generated MAC address for connections to this network. This option does not persist the randomized MAC address.

Value: 2

RANDOMIZATION_PERSISTENT

Added in API level 33
Deprecated in API level 29
static val RANDOMIZATION_PERSISTENT: Int

Deprecated: Deprecated in Java.

Generate a randomized MAC once and reuse it for all connections to this network

Value: 1

SECURITY_TYPE_DPP

Added in API level 33
Deprecated in API level 29
static val SECURITY_TYPE_DPP: Int

Deprecated: Deprecated in Java.

Security type for Easy Connect (DPP) network

Value: 13

SECURITY_TYPE_EAP

Added in API level 30
Deprecated in API level 29
static val SECURITY_TYPE_EAP: Int

Deprecated: Deprecated in Java.

Security type for an EAP network.

Value: 3

SECURITY_TYPE_EAP_SUITE_B

Added in API level 30
Deprecated in API level 29
static val SECURITY_TYPE_EAP_SUITE_B: Int

Deprecated: Use the SECURITY_TYPE_EAP_WPA3_ENTERPRISE_192_BIT constant (which is the same value).

Security type for a WPA3-Enterprise in 192-bit security network.

Value: 5

SECURITY_TYPE_EAP_WPA3_ENTERPRISE

Added in API level 31
Deprecated in API level 29
static val SECURITY_TYPE_EAP_WPA3_ENTERPRISE: Int

Deprecated: Deprecated in Java.

Security type for a WPA3-Enterprise network.

Value: 9

SECURITY_TYPE_EAP_WPA3_ENTERPRISE_192_BIT

Added in API level 31
Deprecated in API level 29
static val SECURITY_TYPE_EAP_WPA3_ENTERPRISE_192_BIT: Int

Deprecated: Deprecated in Java.

Security type for a WPA3-Enterprise in 192-bit security network. This is the same as SECURITY_TYPE_EAP_SUITE_B and uses the same value.

Value: 5

SECURITY_TYPE_OPEN

Added in API level 30
Deprecated in API level 29
static val SECURITY_TYPE_OPEN: Int

Deprecated: Deprecated in Java.

Security type for an open network.

Value: 0

SECURITY_TYPE_OWE

Added in API level 30
Deprecated in API level 29
static val SECURITY_TYPE_OWE: Int

Deprecated: Deprecated in Java.

Security type for an OWE network.

Value: 6

SECURITY_TYPE_PSK

Added in API level 30
Deprecated in API level 29
static val SECURITY_TYPE_PSK: Int

Deprecated: Deprecated in Java.

Security type for a PSK network.

Value: 2

SECURITY_TYPE_SAE

Added in API level 30
Deprecated in API level 29
static val SECURITY_TYPE_SAE: Int

Deprecated: Deprecated in Java.

Security type for an SAE network.

Value: 4

SECURITY_TYPE_WAPI_CERT

Added in API level 30
Deprecated in API level 29
static val SECURITY_TYPE_WAPI_CERT: Int

Deprecated: Deprecated in Java.

Security type for a WAPI Certificate network.

Value: 8

SECURITY_TYPE_WAPI_PSK

Added in API level 30
Deprecated in API level 29
static val SECURITY_TYPE_WAPI_PSK: Int

Deprecated: Deprecated in Java.

Security type for a WAPI PSK network.

Value: 7

SECURITY_TYPE_WEP

Added in API level 30
Deprecated in API level 29
static val SECURITY_TYPE_WEP: Int

Deprecated: Deprecated in Java.

Security type for a WEP network.

Value: 1

Public constructors

WifiConfiguration

Added in API level 1
WifiConfiguration()

WifiConfiguration

Added in API level 30
WifiConfiguration(source: WifiConfiguration)

Copy constructor

Parameters
source WifiConfiguration: This value cannot be null.

Public methods

describeContents

open fun describeContents(): Int

Deprecated: Deprecated in Java.

Implement the Parcelable interface {@hide}

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

getHttpProxy

Added in API level 26
Deprecated in API level 29
open fun getHttpProxy(): ProxyInfo!

Deprecated: Deprecated in Java.

Returns the HTTP proxy used by this object.

Return
ProxyInfo! a httpProxy representing the proxy specified by this WifiConfiguration, or null if no proxy is specified.

getKey

Added in API level 30
Deprecated in API level 29
open fun getKey(): String

Deprecated: Deprecated in Java.

Return a String that can be used to uniquely identify this WifiConfiguration.
Note: Do not persist this value! This value is not guaranteed to remain backwards compatible.

Return
String This value cannot be null.

getMacRandomizationSetting

Added in API level 33
Deprecated in API level 29
open fun getMacRandomizationSetting(): Int

Deprecated: Deprecated in Java.

Get the MAC randomization setting for this network.

Return
Int Value is android.net.wifi.WifiConfiguration#RANDOMIZATION_NONE, android.net.wifi.WifiConfiguration#RANDOMIZATION_PERSISTENT, android.net.wifi.WifiConfiguration#RANDOMIZATION_NON_PERSISTENT, or android.net.wifi.WifiConfiguration#RANDOMIZATION_AUTO

getRandomizedMacAddress

Added in API level 29
Deprecated in API level 29
open fun getRandomizedMacAddress(): MacAddress

Deprecated: Deprecated in Java.

Returns MAC address set to be the local randomized MAC address. Depending on user preference, the device may or may not use the returned MAC address for connections to this network.

Information is restricted to Device Owner, Profile Owner, and Carrier apps (which will only obtain addresses for configurations which they create). Other callers will receive a default "02:00:00:00:00:00" MAC address.

Return
MacAddress This value cannot be null.

isDppConfigurator

Added in API level 33
Deprecated in API level 29
open fun isDppConfigurator(): Boolean

Deprecated: Deprecated in Java.

To check if this WifiConfiguration supports configuring a peer Enrollee device with SECURITY_TYPE_DPP

isPasspoint

Added in API level 23
Deprecated in API level 29
open fun isPasspoint(): Boolean

Deprecated: Deprecated in Java.

Identify if this configuration represents a Passpoint network

setHttpProxy

Added in API level 26
Deprecated in API level 29
open fun setHttpProxy(httpProxy: ProxyInfo!): Unit

Deprecated: Deprecated in Java.

Set the ProxyInfo for this WifiConfiguration. This method should only be used by a device owner or profile owner. When other apps attempt to save a WifiConfiguration with modified proxy settings, the methods WifiManager#addNetwork and WifiManager#updateNetwork fail and return -1.

Parameters
httpProxy ProxyInfo!: ProxyInfo representing the httpProxy to be used by this WifiConfiguration. Setting this to null will explicitly set no proxy, removing any proxy that was previously set.

setIpConfiguration

Added in API level 33
Deprecated in API level 29
open fun setIpConfiguration(ipConfiguration: IpConfiguration?): Unit

Deprecated: Deprecated in Java.

Set the IpConfiguration for this network.

Parameters
ipConfiguration IpConfiguration?: a IpConfiguration to use for this Wi-Fi configuration, or null to use the default configuration.

setMacRandomizationSetting

Added in API level 33
Deprecated in API level 29
open fun setMacRandomizationSetting(macRandomizationSetting: Int): Unit

Deprecated: Deprecated in Java.

Set the MAC randomization setting for this network.

Caller must satify one of the following conditions:

  • Have android.Manifest.permission#NETWORK_SETTINGS permission.
  • Have android.Manifest.permission#NETWORK_SETUP_WIZARD permission.
  • Be in Demo Mode.
  • Be the creator adding or updating a passpoint network.
  • Be an admin updating their own network.
Parameters
macRandomizationSetting Int: Value is android.net.wifi.WifiConfiguration#RANDOMIZATION_NONE, android.net.wifi.WifiConfiguration#RANDOMIZATION_PERSISTENT, android.net.wifi.WifiConfiguration#RANDOMIZATION_NON_PERSISTENT, or android.net.wifi.WifiConfiguration#RANDOMIZATION_AUTO

setSecurityParams

Added in API level 30
Deprecated in API level 29
open fun setSecurityParams(securityType: Int): Unit

Deprecated: Deprecated in Java.

Set the various security params to correspond to the provided security type. This is accomplished by setting the various BitSets exposed in WifiConfiguration.
This API would clear existing security types and add a default one. Before calling this API with SECURITY_TYPE_DPP as securityType, call android.net.wifi.WifiManager#isEasyConnectDppAkmSupported()}

toString

Added in API level 1
open fun toString(): String

Deprecated: Deprecated in Java.

Return
String a string representation of the object.

writeToParcel

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

Deprecated: Deprecated in Java.

Implement the Parcelable interface {@hide}

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

BSSID

Added in API level 1
var BSSID: String!

Deprecated: Deprecated in Java.

When set, this network configuration entry should only be used when associating with the AP having the specified BSSID. The value is a string in the format of an Ethernet MAC address, e.g., XX:XX:XX:XX:XX:XX where each X is a hex digit.

FQDN

Added in API level 21
Deprecated in API level 29
var FQDN: String!

Deprecated: Deprecated in Java.

Fully qualified domain name of a Passpoint configuration

SSID

Added in API level 1
var SSID: String!

Deprecated: Deprecated in Java.

The network's SSID. Can either be a UTF-8 string, which must be enclosed in double quotation marks (e.g., "MyNetwork"), or a string of hex digits, which are not enclosed in quotes (e.g., 01a243f405).

allowedAuthAlgorithms

Added in API level 1
var allowedAuthAlgorithms: BitSet

Deprecated: Deprecated in Java.

The set of authentication protocols supported by this configuration. See AuthAlgorithm for descriptions of the values. Defaults to automatic selection.

allowedGroupCiphers

Added in API level 1
var allowedGroupCiphers: BitSet

Deprecated: Deprecated in Java.

The set of group ciphers supported by this configuration. See GroupCipher for descriptions of the values. Defaults to CCMP TKIP WEP104 WEP40.

allowedGroupManagementCiphers

Added in API level 29
Deprecated in API level 29
var allowedGroupManagementCiphers: BitSet

Deprecated: Deprecated in Java.

The set of group management ciphers supported by this configuration. See GroupMgmtCipher for descriptions of the values.

allowedKeyManagement

Added in API level 1
var allowedKeyManagement: BitSet

Deprecated: Deprecated in Java.

The set of key management protocols supported by this configuration. See KeyMgmt for descriptions of the values. Defaults to WPA-PSK WPA-EAP.

allowedPairwiseCiphers

Added in API level 1
var allowedPairwiseCiphers: BitSet

Deprecated: Deprecated in Java.

The set of pairwise ciphers for WPA supported by this configuration. See PairwiseCipher for descriptions of the values. Defaults to CCMP TKIP.

allowedProtocols

Added in API level 1
var allowedProtocols: BitSet

Deprecated: Deprecated in Java.

The set of security protocols supported by this configuration. See Protocol for descriptions of the values. Defaults to WPA RSN.

allowedSuiteBCiphers

Added in API level 29
Deprecated in API level 29
var allowedSuiteBCiphers: BitSet

Deprecated: Deprecated in Java.

The set of SuiteB ciphers supported by this configuration. To be used for WPA3-Enterprise mode. Set automatically by the framework based on the certificate type that is used in this configuration.

enterpriseConfig

Added in API level 18
Deprecated in API level 29
var enterpriseConfig: WifiEnterpriseConfig!

Deprecated: Deprecated in Java.

The enterprise configuration details specifying the EAP method, certificates and other settings associated with the EAP.

hiddenSSID

Added in API level 1
var hiddenSSID: Boolean

Deprecated: Deprecated in Java.

This is a network that does not broadcast its SSID, so an SSID-specific probe request must be used for scans.

isHomeProviderNetwork

Added in API level 26
Deprecated in API level 29
var isHomeProviderNetwork: Boolean

Deprecated: Deprecated in Java.

Flag indicating if this network is provided by a home Passpoint provider or a roaming Passpoint provider. This flag will be true if this network is provided by a home Passpoint provider and false if is provided by a roaming Passpoint provider or is a non-Passpoint network.

networkId

Added in API level 1
var networkId: Int

Deprecated: Deprecated in Java.

The ID number that the supplicant uses to identify this network configuration entry. This must be passed as an argument to most calls into the supplicant.

preSharedKey

Added in API level 1
var preSharedKey: String!

Deprecated: Deprecated in Java.

Pre-shared key for use with WPA-PSK. Either an ASCII string enclosed in double quotation marks (e.g., "abcdefghij" for PSK passphrase or a string of 64 hex digits for raw PSK.

When the value of this key is read, the actual key is not returned, just a "*" if the key has a value, or the null string otherwise.

priority

Added in API level 1
Deprecated in API level 26
var priority: Int

Deprecated: This field does not exist anymore.

Priority determines the preference given to a network by wpa_supplicant when choosing an access point with which to associate.

providerFriendlyName

Added in API level 23
Deprecated in API level 29
var providerFriendlyName: String!

Deprecated: Deprecated in Java.

Name of Passpoint credential provider

roamingConsortiumIds

Added in API level 23
Deprecated in API level 29
var roamingConsortiumIds: LongArray!

Deprecated: Deprecated in Java.

Roaming Consortium Id list for Passpoint credential; identifies a set of networks where Passpoint credential will be considered valid

status

Added in API level 1
var status: Int

Deprecated: Deprecated in Java.

The current status of this network configuration entry.

wepKeys

Added in API level 1
Deprecated in API level 28
var wepKeys: Array<String!>!

Deprecated: Due to security and performance limitations, use of WEP networks is discouraged.

Four WEP keys. For each of the four values, provide either an ASCII string enclosed in double quotation marks (e.g., "abcdef") or a string of hex digits (e.g., 0102030405).

When the value of one of these keys is read, the actual key is not returned, just a "*" if the key has a value, or the null string otherwise.

wepTxKeyIndex

Added in API level 1
Deprecated in API level 28
var wepTxKeyIndex: Int

Deprecated: Due to security and performance limitations, use of WEP networks is discouraged.

Default WEP key index, ranging from 0 to 3.