WifiConfiguration
open class WifiConfiguration : Parcelable
kotlin.Any | |
↳ | android.net.wifi.WifiConfiguration |
A class representing a configured Wi-Fi network, including the security configuration. Non privileged caller should use WifiNetworkSpecifier.Builder
to create NetworkSpecifier
and WifiNetworkSuggestion.Builder
to create WifiNetworkSuggestion
. This class can still be used with privileged APIs only such as WifiManager.addNetwork(WifiConfiguration)
.
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 | |
---|---|
WifiConfiguration(source: WifiConfiguration) Copy constructor |
Public methods | |
---|---|
open Int |
Implement the Parcelable interface {@hide} |
open ProxyInfo! |
Returns the HTTP proxy used by this object. |
open String |
getKey() 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 |
open Unit |
setIpConfiguration(ipConfiguration: IpConfiguration?) Set the |
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 |
toString() |
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 |
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
static val RANDOMIZATION_AUTO: Int
Let the wifi framework automatically decide the MAC randomization strategy.
Value: 3
RANDOMIZATION_NONE
static val RANDOMIZATION_NONE: Int
Use factory MAC when connecting to this network
Value: 0
RANDOMIZATION_NON_PERSISTENT
static val RANDOMIZATION_NON_PERSISTENT: Int
Use a randomly generated MAC address for connections to this network. This option does not persist the randomized MAC address.
Value: 2
RANDOMIZATION_PERSISTENT
static val RANDOMIZATION_PERSISTENT: Int
Generate a randomized MAC once and reuse it for all connections to this network
Value: 1
SECURITY_TYPE_DPP
static val SECURITY_TYPE_DPP: Int
Security type for Easy Connect (DPP) network
Value: 13
SECURITY_TYPE_EAP
static val SECURITY_TYPE_EAP: Int
Security type for an EAP network.
Value: 3
SECURITY_TYPE_EAP_SUITE_B
static valSECURITY_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
static val SECURITY_TYPE_EAP_WPA3_ENTERPRISE: Int
Security type for a WPA3-Enterprise network.
Value: 9
SECURITY_TYPE_EAP_WPA3_ENTERPRISE_192_BIT
static val SECURITY_TYPE_EAP_WPA3_ENTERPRISE_192_BIT: Int
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
static val SECURITY_TYPE_OPEN: Int
Security type for an open network.
Value: 0
SECURITY_TYPE_OWE
static val SECURITY_TYPE_OWE: Int
Security type for an OWE network.
Value: 6
SECURITY_TYPE_PSK
static val SECURITY_TYPE_PSK: Int
Security type for a PSK network.
Value: 2
SECURITY_TYPE_SAE
static val SECURITY_TYPE_SAE: Int
Security type for an SAE network.
Value: 4
SECURITY_TYPE_WAPI_CERT
static val SECURITY_TYPE_WAPI_CERT: Int
Security type for a WAPI Certificate network.
Value: 8
SECURITY_TYPE_WAPI_PSK
static val SECURITY_TYPE_WAPI_PSK: Int
Security type for a WAPI PSK network.
Value: 7
SECURITY_TYPE_WEP
static val SECURITY_TYPE_WEP: Int
Security type for a WEP network.
Value: 1
Public constructors
WifiConfiguration
WifiConfiguration(source: WifiConfiguration)
Copy constructor
Parameters | |
---|---|
source |
WifiConfiguration: This value cannot be null . |
Public methods
describeContents
open fun describeContents(): Int
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
open fun getHttpProxy(): ProxyInfo!
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
open fun getKey(): String
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
open fun getMacRandomizationSetting(): Int
Get the MAC randomization setting for this network.
getRandomizedMacAddress
open fun getRandomizedMacAddress(): MacAddress
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
open fun isDppConfigurator(): Boolean
To check if this WifiConfiguration supports configuring a peer Enrollee device with SECURITY_TYPE_DPP
isPasspoint
open fun isPasspoint(): Boolean
Identify if this configuration represents a Passpoint network
setHttpProxy
open fun setHttpProxy(httpProxy: ProxyInfo!): Unit
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
open fun setIpConfiguration(ipConfiguration: IpConfiguration?): Unit
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
open fun setMacRandomizationSetting(macRandomizationSetting: Int): Unit
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.
setSecurityParams
open fun setSecurityParams(securityType: Int): Unit
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
open fun toString(): String
Return | |
---|---|
String |
a string representation of the object. |
writeToParcel
open fun writeToParcel(
dest: Parcel,
flags: Int
): Unit
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
var BSSID: String!
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
var FQDN: String!
Fully qualified domain name of a Passpoint configuration
SSID
var SSID: String!
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
var allowedAuthAlgorithms: BitSet
The set of authentication protocols supported by this configuration. See AuthAlgorithm
for descriptions of the values. Defaults to automatic selection.
allowedGroupCiphers
var allowedGroupCiphers: BitSet
The set of group ciphers supported by this configuration. See GroupCipher
for descriptions of the values. Defaults to CCMP TKIP WEP104 WEP40.
allowedGroupManagementCiphers
var allowedGroupManagementCiphers: BitSet
The set of group management ciphers supported by this configuration. See GroupMgmtCipher
for descriptions of the values.
allowedKeyManagement
var allowedKeyManagement: BitSet
The set of key management protocols supported by this configuration. See KeyMgmt
for descriptions of the values. Defaults to WPA-PSK WPA-EAP.
allowedPairwiseCiphers
var allowedPairwiseCiphers: BitSet
The set of pairwise ciphers for WPA supported by this configuration. See PairwiseCipher
for descriptions of the values. Defaults to CCMP TKIP.
allowedProtocols
var allowedProtocols: BitSet
The set of security protocols supported by this configuration. See Protocol
for descriptions of the values. Defaults to WPA RSN.
allowedSuiteBCiphers
var allowedSuiteBCiphers: BitSet
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
var enterpriseConfig: WifiEnterpriseConfig!
The enterprise configuration details specifying the EAP method, certificates and other settings associated with the EAP.
hiddenSSID
var hiddenSSID: Boolean
This is a network that does not broadcast its SSID, so an SSID-specific probe request must be used for scans.
isHomeProviderNetwork
var isHomeProviderNetwork: Boolean
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
var networkId: Int
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
var preSharedKey: String!
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.
priority
varpriority: 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
var providerFriendlyName: String!
Name of Passpoint credential provider
roamingConsortiumIds
var roamingConsortiumIds: LongArray!
Roaming Consortium Id list for Passpoint credential; identifies a set of networks where Passpoint credential will be considered valid
wepKeys
varwepKeys: 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
).
wepTxKeyIndex
varwepTxKeyIndex: Int
Deprecated: Due to security and performance limitations, use of WEP networks is discouraged.
Default WEP key index, ranging from 0 to 3.