# Print output for @column tags ?> WifiConfiguration - Android SDK | Android Developers

Most visited

Recently visited

WifiConfiguration

public class WifiConfiguration
extends Object implements Parcelable

java.lang.Object
   ↳ android.net.wifi.WifiConfiguration


This class is deprecated.
Use WifiNetworkSpecifier.Builder to create NetworkSpecifier and WifiNetworkSuggestion.Builder to create WifiNetworkSuggestion. This will become a system use only object in the future.

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

Summary

Nested classes

class WifiConfiguration.AuthAlgorithm

Recognized IEEE 802.11 authentication algorithms. 

class WifiConfiguration.GroupCipher

Recognized group ciphers. 

class WifiConfiguration.GroupMgmtCipher

Recognized group management ciphers. 

class WifiConfiguration.KeyMgmt

Recognized key management schemes. 

class WifiConfiguration.PairwiseCipher

Recognized pairwise ciphers for WPA. 

class WifiConfiguration.Protocol

Recognized security protocols. 

class WifiConfiguration.Status

Possible status of a network configuration. 

Constants

int SECURITY_TYPE_EAP

Security type for an EAP network.

int SECURITY_TYPE_EAP_SUITE_B

Security type for an EAP Suite B network.

int SECURITY_TYPE_OPEN

Security type for an open network.

int SECURITY_TYPE_OWE

Security type for an OWE network.

int SECURITY_TYPE_PSK

Security type for a PSK network.

int SECURITY_TYPE_SAE

Security type for an SAE network.

int SECURITY_TYPE_WAPI_CERT

Security type for a WAPI Certificate network.

int SECURITY_TYPE_WAPI_PSK

Security type for a WAPI PSK network.

int SECURITY_TYPE_WEP

Security type for a WEP network.

Inherited constants

Fields

public String BSSID

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

public String FQDN

Fully qualified domain name of a Passpoint configuration

public String SSID

The network's SSID.

public BitSet allowedAuthAlgorithms

The set of authentication protocols supported by this configuration.

public BitSet allowedGroupCiphers

The set of group ciphers supported by this configuration.

public BitSet allowedGroupManagementCiphers

The set of group management ciphers supported by this configuration.

public BitSet allowedKeyManagement

The set of key management protocols supported by this configuration.

public BitSet allowedPairwiseCiphers

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

public BitSet allowedProtocols

The set of security protocols supported by this configuration.

public BitSet allowedSuiteBCiphers

The set of SuiteB ciphers supported by this configuration.

public WifiEnterpriseConfig enterpriseConfig

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

public boolean hiddenSSID

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

public boolean isHomeProviderNetwork

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

public int networkId

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

public String preSharedKey

Pre-shared key for use with WPA-PSK.

public int priority

This field is deprecated. This field does not exist anymore.

public String providerFriendlyName

Name of Passpoint credential provider

public long[] roamingConsortiumIds

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

public int status

The current status of this network configuration entry.

public String[] wepKeys

This field is deprecated. Due to security and performance limitations, use of WEP networks is discouraged.

public int wepTxKeyIndex

This field is deprecated. Due to security and performance limitations, use of WEP networks is discouraged.

Public constructors

WifiConfiguration()
WifiConfiguration(WifiConfiguration source)

Copy constructor

Public methods

ProxyInfo getHttpProxy()

Returns the HTTP proxy used by this object.

String getKey()

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

MacAddress getRandomizedMacAddress()

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

boolean isPasspoint()

Identify if this configuration represents a Passpoint network

void setHttpProxy(ProxyInfo httpProxy)

Set the ProxyInfo for this WifiConfiguration.

void setSecurityParams(int securityType)

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

String toString()

Returns a string representation of the object.

Inherited methods

Constants

SECURITY_TYPE_EAP

public static final int SECURITY_TYPE_EAP

Security type for an EAP network.

Constant Value: 3 (0x00000003)

SECURITY_TYPE_EAP_SUITE_B

public static final int SECURITY_TYPE_EAP_SUITE_B

Security type for an EAP Suite B network.

Constant Value: 5 (0x00000005)

SECURITY_TYPE_OPEN

public static final int SECURITY_TYPE_OPEN

Security type for an open network.

Constant Value: 0 (0x00000000)

SECURITY_TYPE_OWE

public static final int SECURITY_TYPE_OWE

Security type for an OWE network.

Constant Value: 6 (0x00000006)

SECURITY_TYPE_PSK

public static final int SECURITY_TYPE_PSK

Security type for a PSK network.

Constant Value: 2 (0x00000002)

SECURITY_TYPE_SAE

public static final int SECURITY_TYPE_SAE

Security type for an SAE network.

Constant Value: 4 (0x00000004)

SECURITY_TYPE_WAPI_CERT

public static final int SECURITY_TYPE_WAPI_CERT

Security type for a WAPI Certificate network.

Constant Value: 8 (0x00000008)

SECURITY_TYPE_WAPI_PSK

public static final int SECURITY_TYPE_WAPI_PSK

Security type for a WAPI PSK network.

Constant Value: 7 (0x00000007)

SECURITY_TYPE_WEP

public static final int SECURITY_TYPE_WEP

Security type for a WEP network.

Constant Value: 1 (0x00000001)

Fields

BSSID

public String BSSID

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

public String FQDN

Fully qualified domain name of a Passpoint configuration

SSID

public String SSID

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

public BitSet allowedAuthAlgorithms

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

allowedGroupCiphers

public BitSet allowedGroupCiphers

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

allowedGroupManagementCiphers

public BitSet allowedGroupManagementCiphers

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

allowedKeyManagement

public BitSet allowedKeyManagement

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

allowedPairwiseCiphers

public BitSet allowedPairwiseCiphers

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

allowedProtocols

public BitSet allowedProtocols

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

allowedSuiteBCiphers

public BitSet allowedSuiteBCiphers

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

public WifiEnterpriseConfig enterpriseConfig

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

hiddenSSID

public boolean hiddenSSID

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

isHomeProviderNetwork

public boolean isHomeProviderNetwork

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

public int networkId

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

public String preSharedKey

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

public int priority

This field is 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

public String providerFriendlyName

Name of Passpoint credential provider

roamingConsortiumIds

public long[] roamingConsortiumIds

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

status

public int status

The current status of this network configuration entry.

See also:

wepKeys

public String[] wepKeys

This field is 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"), a string of hex digits (e.g., 0102030405), or an empty string (e.g., "").

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

public int wepTxKeyIndex

This field is deprecated.
Due to security and performance limitations, use of WEP networks is discouraged.

Default WEP key index, ranging from 0 to 3.

Public constructors

WifiConfiguration

public WifiConfiguration ()

WifiConfiguration

public WifiConfiguration (WifiConfiguration source)

Copy constructor

Parameters
source WifiConfiguration: This value cannot be null.

Public methods

getHttpProxy

public ProxyInfo getHttpProxy ()

Returns the HTTP proxy used by this object.

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

getKey

public String getKey ()

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.

Returns
String This value cannot be null.

getRandomizedMacAddress

public MacAddress getRandomizedMacAddress ()

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.

Returns
MacAddress This value cannot be null.

isPasspoint

public boolean isPasspoint ()

Identify if this configuration represents a Passpoint network

Returns
boolean

setHttpProxy

public void setHttpProxy (ProxyInfo httpProxy)

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.

Throws
IllegalArgumentException for invalid httpProxy

setSecurityParams

public void setSecurityParams (int securityType)

Set the various security params to correspond to the provided security type. This is accomplished by setting the various BitSets exposed in WifiConfiguration.

Parameters
securityType int: One of the following security types: SECURITY_TYPE_OPEN, SECURITY_TYPE_WEP, SECURITY_TYPE_PSK, SECURITY_TYPE_EAP, SECURITY_TYPE_SAE, SECURITY_TYPE_EAP_SUITE_B, SECURITY_TYPE_OWE, SECURITY_TYPE_WAPI_PSK, or SECURITY_TYPE_WAPI_CERT Value is SECURITY_TYPE_OPEN, SECURITY_TYPE_WEP, SECURITY_TYPE_PSK, SECURITY_TYPE_EAP, SECURITY_TYPE_SAE, SECURITY_TYPE_EAP_SUITE_B, SECURITY_TYPE_OWE, SECURITY_TYPE_WAPI_PSK, or SECURITY_TYPE_WAPI_CERT

toString

public String toString ()

Returns a string representation of the object. In general, the toString method returns a string that "textually represents" this object. The result should be a concise but informative representation that is easy for a person to read. It is recommended that all subclasses override this method.

The toString method for class Object returns a string consisting of the name of the class of which the object is an instance, the at-sign character `@', and the unsigned hexadecimal representation of the hash code of the object. In other words, this method returns a string equal to the value of:

 getClass().getName() + '@' + Integer.toHexString(hashCode())
 

Returns
String a string representation of the object.