ScanResult


public final class ScanResult
extends Object implements Parcelable

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


Describes information about a detected access point. In addition to the attributes described here, the supplicant keeps track of quality, noise, and maxbitrate attributes, but does not currently report them to external clients.

Summary

Nested classes

class ScanResult.InformationElement

information elements from beacon. 

Constants

int CHANNEL_WIDTH_160MHZ

AP Channel bandwidth is 160 MHZ

int CHANNEL_WIDTH_20MHZ

AP Channel bandwidth is 20 MHZ

int CHANNEL_WIDTH_320MHZ

AP Channel bandwidth is 320 MHZ

int CHANNEL_WIDTH_40MHZ

AP Channel bandwidth is 40 MHZ

int CHANNEL_WIDTH_80MHZ

AP Channel bandwidth is 80 MHZ

int CHANNEL_WIDTH_80MHZ_PLUS_MHZ

AP Channel bandwidth is 160 MHZ, but 80MHZ + 80MHZ

int PREAMBLE_EHT

Preamble type: EHT.

int PREAMBLE_HE

Preamble type: HE.

int PREAMBLE_HT

Preamble type: HT.

int PREAMBLE_LEGACY

Preamble type: Legacy.

int PREAMBLE_VHT

Preamble type: VHT.

int UNSPECIFIED

The unspecified value.

int WIFI_BAND_24_GHZ

Wi-Fi 2.4 GHz band.

int WIFI_BAND_5_GHZ

Wi-Fi 5 GHz band.

int WIFI_BAND_60_GHZ

Wi-Fi 60 GHz band.

int WIFI_BAND_6_GHZ

Wi-Fi 6 GHz band.

int WIFI_STANDARD_11AC

Wi-Fi 802.11ac

int WIFI_STANDARD_11AD

Wi-Fi 802.11ad

int WIFI_STANDARD_11AX

Wi-Fi 802.11ax

int WIFI_STANDARD_11BE

Wi-Fi 802.11be

int WIFI_STANDARD_11N

Wi-Fi 802.11n

int WIFI_STANDARD_LEGACY

Wi-Fi 802.11a/b/g

int WIFI_STANDARD_UNKNOWN

Wi-Fi unknown standard

Inherited constants

Fields

public String BSSID

The address of the access point.

public static final Creator<ScanResult> CREATOR

Implement the Parcelable interface

public String SSID

This field was deprecated in API level 33. Use getWifiSsid() instead.

public String capabilities

Describes the authentication, key management, and encryption schemes supported by the access point.

public int centerFreq0

Not used if the AP bandwidth is 20 MHz If the AP use 40, 80, 160 or 320MHz, this is the center frequency (in MHz) if the AP use 80 + 80 MHz, this is the center frequency of the first segment (in MHz)

public int centerFreq1

Only used if the AP bandwidth is 80 + 80 MHz if the AP use 80 + 80 MHz, this is the center frequency of the second segment (in MHz)

public int channelWidth

AP Channel bandwidth; one of CHANNEL_WIDTH_20MHZ, CHANNEL_WIDTH_40MHZ, CHANNEL_WIDTH_80MHZ, CHANNEL_WIDTH_160MHZ, CHANNEL_WIDTH_320MHZ, or CHANNEL_WIDTH_80MHZ_PLUS_MHZ, or CHANNEL_WIDTH_320MHZ
Value is CHANNEL_WIDTH_20MHZ, CHANNEL_WIDTH_40MHZ, CHANNEL_WIDTH_80MHZ, CHANNEL_WIDTH_160MHZ, CHANNEL_WIDTH_80MHZ_PLUS_MHZ, or CHANNEL_WIDTH_320MHZ

public int frequency

The center frequency of the primary 20 MHz frequency (in MHz) of the channel over which the client is communicating with the access point.

public int level

The detected signal level in dBm, also known as the RSSI.

public CharSequence operatorFriendlyName

This field was deprecated in API level 31. - Use WifiInfo.getPasspointProviderFriendlyName()

public long timestamp

timestamp in microseconds (since boot) when this result was last seen.

public CharSequence venueName

This field was deprecated in API level 31. - This information is not provided

Public constructors

ScanResult()

Construct an empty scan result.

ScanResult(ScanResult source)

copy constructor

Public methods

static int convertChannelToFrequencyMhzIfSupported(int channel, int band)

Utility function to convert Wi-Fi channel number to frequency in MHz.

static int convertFrequencyMhzToChannelIfSupported(int freqMhz)

Utility function to convert frequency in MHz to channel number.

List<MloLink> getAffiliatedMloLinks()

Return the Multi-Link Operation (MLO) affiliated Links for Wi-Fi 7 access points.

MacAddress getApMldMacAddress()

Return the access point Multi-Link Device (MLD) MAC Address for Wi-Fi 7 access points.

int getApMloLinkId()

Return the access point Multi-Link Operation (MLO) link-id for Wi-Fi 7 access points.

List<ScanResult.InformationElement> getInformationElements()

Get all information elements found in the beacon.

int[] getSecurityTypes()

Get all the security types supported by this ScanResult.

WifiSsid getWifiSsid()

The SSID of the access point.

int getWifiStandard()

return the AP wifi standard.

boolean is80211azNtbResponder()
boolean is80211mcResponder()
boolean isPasspointNetwork()
boolean isRangingFrameProtectionRequired()

Returns whether the AP requires frame protection for ranging measurement.

boolean isSecureHeLtfSupported()

Returns whether the AP supports secure HE-LTF for ranging measurement.

boolean isTwtResponder()
String toString()

Returns a string representation of the object.

Inherited methods

Constants

CHANNEL_WIDTH_160MHZ

Added in API level 23
public static final int CHANNEL_WIDTH_160MHZ

AP Channel bandwidth is 160 MHZ

Constant Value: 3 (0x00000003)

CHANNEL_WIDTH_20MHZ

Added in API level 23
public static final int CHANNEL_WIDTH_20MHZ

AP Channel bandwidth is 20 MHZ

Constant Value: 0 (0x00000000)

CHANNEL_WIDTH_320MHZ

Added in API level 33
public static final int CHANNEL_WIDTH_320MHZ

AP Channel bandwidth is 320 MHZ

Constant Value: 5 (0x00000005)

CHANNEL_WIDTH_40MHZ

Added in API level 23
public static final int CHANNEL_WIDTH_40MHZ

AP Channel bandwidth is 40 MHZ

Constant Value: 1 (0x00000001)

CHANNEL_WIDTH_80MHZ

Added in API level 23
public static final int CHANNEL_WIDTH_80MHZ

AP Channel bandwidth is 80 MHZ

Constant Value: 2 (0x00000002)

CHANNEL_WIDTH_80MHZ_PLUS_MHZ

Added in API level 23
public static final int CHANNEL_WIDTH_80MHZ_PLUS_MHZ

AP Channel bandwidth is 160 MHZ, but 80MHZ + 80MHZ

Constant Value: 4 (0x00000004)

PREAMBLE_EHT

Added in API level 33
public static final int PREAMBLE_EHT

Preamble type: EHT.

Constant Value: 4 (0x00000004)

PREAMBLE_HE

Added in API level 33
public static final int PREAMBLE_HE

Preamble type: HE.

Constant Value: 3 (0x00000003)

PREAMBLE_HT

Added in API level 33
public static final int PREAMBLE_HT

Preamble type: HT.

Constant Value: 1 (0x00000001)

PREAMBLE_LEGACY

Added in API level 33
public static final int PREAMBLE_LEGACY

Preamble type: Legacy.

Constant Value: 0 (0x00000000)

PREAMBLE_VHT

Added in API level 33
public static final int PREAMBLE_VHT

Preamble type: VHT.

Constant Value: 2 (0x00000002)

UNSPECIFIED

Added in API level 31
public static final int UNSPECIFIED

The unspecified value.

Constant Value: -1 (0xffffffff)

WIFI_BAND_24_GHZ

Added in API level 31
public static final int WIFI_BAND_24_GHZ

Wi-Fi 2.4 GHz band.

Constant Value: 1 (0x00000001)

WIFI_BAND_5_GHZ

Added in API level 31
public static final int WIFI_BAND_5_GHZ

Wi-Fi 5 GHz band.

Constant Value: 2 (0x00000002)

WIFI_BAND_60_GHZ

Added in API level 31
public static final int WIFI_BAND_60_GHZ

Wi-Fi 60 GHz band.

Constant Value: 16 (0x00000010)

WIFI_BAND_6_GHZ

Added in API level 31
public static final int WIFI_BAND_6_GHZ

Wi-Fi 6 GHz band.

Constant Value: 8 (0x00000008)

WIFI_STANDARD_11AC

Added in API level 30
public static final int WIFI_STANDARD_11AC

Wi-Fi 802.11ac

Constant Value: 5 (0x00000005)

WIFI_STANDARD_11AD

Added in API level 31
public static final int WIFI_STANDARD_11AD

Wi-Fi 802.11ad

Constant Value: 7 (0x00000007)

WIFI_STANDARD_11AX

Added in API level 30
public static final int WIFI_STANDARD_11AX

Wi-Fi 802.11ax

Constant Value: 6 (0x00000006)

WIFI_STANDARD_11BE

Added in API level 33
public static final int WIFI_STANDARD_11BE

Wi-Fi 802.11be

Constant Value: 8 (0x00000008)

WIFI_STANDARD_11N

Added in API level 30
public static final int WIFI_STANDARD_11N

Wi-Fi 802.11n

Constant Value: 4 (0x00000004)

WIFI_STANDARD_LEGACY

Added in API level 30
public static final int WIFI_STANDARD_LEGACY

Wi-Fi 802.11a/b/g

Constant Value: 1 (0x00000001)

WIFI_STANDARD_UNKNOWN

Added in API level 30
public static final int WIFI_STANDARD_UNKNOWN

Wi-Fi unknown standard

Constant Value: 0 (0x00000000)

Fields

BSSID

Added in API level 1
public String BSSID

The address of the access point.

CREATOR

Added in API level 30
public static final Creator<ScanResult> CREATOR

Implement the Parcelable interface

SSID

Added in API level 1
Deprecated in API level 33
public String SSID

This field was deprecated in API level 33.
Use getWifiSsid() instead.

The network name.

capabilities

Added in API level 1
public String capabilities

Describes the authentication, key management, and encryption schemes supported by the access point.

centerFreq0

Added in API level 23
public int centerFreq0

Not used if the AP bandwidth is 20 MHz If the AP use 40, 80, 160 or 320MHz, this is the center frequency (in MHz) if the AP use 80 + 80 MHz, this is the center frequency of the first segment (in MHz)

centerFreq1

Added in API level 23
public int centerFreq1

Only used if the AP bandwidth is 80 + 80 MHz if the AP use 80 + 80 MHz, this is the center frequency of the second segment (in MHz)

frequency

Added in API level 1
public int frequency

The center frequency of the primary 20 MHz frequency (in MHz) of the channel over which the client is communicating with the access point.

level

Added in API level 1
public int level

The detected signal level in dBm, also known as the RSSI.

Use WifiManager.calculateSignalLevel(int) to convert this number into an absolute signal level which can be displayed to a user.

operatorFriendlyName

Added in API level 23
Deprecated in API level 31
public CharSequence operatorFriendlyName

This field was deprecated in API level 31.
- Use WifiInfo.getPasspointProviderFriendlyName()

Indicates Passpoint operator name published by access point.

timestamp

Added in API level 17
public long timestamp

timestamp in microseconds (since boot) when this result was last seen.

venueName

Added in API level 23
Deprecated in API level 31
public CharSequence venueName

This field was deprecated in API level 31.
- This information is not provided

Indicates venue name (such as 'San Francisco Airport') published by access point; only available on Passpoint network and if published by access point.

Public constructors

ScanResult

Added in API level 30
public ScanResult ()

Construct an empty scan result.

ScanResult

Added in API level 30
public ScanResult (ScanResult source)

copy constructor

Parameters
source ScanResult: This value cannot be null.

Public methods

convertChannelToFrequencyMhzIfSupported

Added in API level 31
public static int convertChannelToFrequencyMhzIfSupported (int channel, 
                int band)

Utility function to convert Wi-Fi channel number to frequency in MHz. Reference the Wi-Fi channel numbering and the channelization in IEEE 802.11-2016 specifications, section 17.3.8.4.2, 17.3.8.4.3 and Table 15-6. See also convertFrequencyMhzToChannelIfSupported(int).

Parameters
channel int: number to convert.

band int: of channel to convert. One of the following bands: WIFI_BAND_24_GHZ, WIFI_BAND_5_GHZ, WIFI_BAND_6_GHZ, WIFI_BAND_60_GHZ. Value is UNSPECIFIED, WIFI_BAND_24_GHZ, WIFI_BAND_5_GHZ, WIFI_BAND_6_GHZ, or WIFI_BAND_60_GHZ

Returns
int center frequency in Mhz of the channel, UNSPECIFIED if no match

convertFrequencyMhzToChannelIfSupported

Added in API level 31
public static int convertFrequencyMhzToChannelIfSupported (int freqMhz)

Utility function to convert frequency in MHz to channel number. See also convertChannelToFrequencyMhzIfSupported(int, int).

Parameters
freqMhz int: frequency in MHz

Returns
int channel number associated with given frequency, UNSPECIFIED if no match

getAffiliatedMloLinks

Added in API level 33
public List<MloLink> getAffiliatedMloLinks ()

Return the Multi-Link Operation (MLO) affiliated Links for Wi-Fi 7 access points. i.e. when getWifiStandard() returns WIFI_STANDARD_11BE.

Returns
List<MloLink> List of affiliated MLO links, or an empty list if access point is not Wi-Fi 7 This value cannot be null.

getApMldMacAddress

Added in API level 33
public MacAddress getApMldMacAddress ()

Return the access point Multi-Link Device (MLD) MAC Address for Wi-Fi 7 access points. i.e. getWifiStandard() returns WIFI_STANDARD_11BE.

Returns
MacAddress MLD MAC Address for access point if exists (Wi-Fi 7 access points), null otherwise.

getApMloLinkId

Added in API level 33
public int getApMloLinkId ()

Return the access point Multi-Link Operation (MLO) link-id for Wi-Fi 7 access points. i.e. when getWifiStandard() returns WIFI_STANDARD_11BE, otherwise return MloLink.INVALID_MLO_LINK_ID. Valid values are 0-15 as described in IEEE 802.11be Specification, section 9.4.2.295b.2.

Returns
int MloLink.INVALID_MLO_LINK_ID or a valid value (0-15). Value is between MloLink.INVALID_MLO_LINK_ID and MloLink.MAX_MLO_LINK_ID inclusive

getInformationElements

Added in API level 30
public List<ScanResult.InformationElement> getInformationElements ()

Get all information elements found in the beacon.

Returns
List<ScanResult.InformationElement> This value cannot be null.

getWifiSsid

Added in API level 33
public WifiSsid getWifiSsid ()

The SSID of the access point.

Returns
WifiSsid This value may be null.

getWifiStandard

Added in API level 30
public int getWifiStandard ()

return the AP wifi standard.

Returns
int Value is WIFI_STANDARD_UNKNOWN, WIFI_STANDARD_LEGACY, WIFI_STANDARD_11N, WIFI_STANDARD_11AC, WIFI_STANDARD_11AX, WIFI_STANDARD_11AD, or WIFI_STANDARD_11BE

is80211azNtbResponder

Added in API level 35
public boolean is80211azNtbResponder ()

Returns
boolean whether AP is a IEEE802.11az Non-Trigger based Ranging Responder.

is80211mcResponder

Added in API level 23
public boolean is80211mcResponder ()

Returns
boolean

isPasspointNetwork

Added in API level 23
public boolean isPasspointNetwork ()

Returns
boolean

isRangingFrameProtectionRequired

public boolean isRangingFrameProtectionRequired ()

Returns whether the AP requires frame protection for ranging measurement. Ranging frame protection in IEEE 802.11az, also known as URNM-MFPR (Unassociated Range Negotiation and Measurement Management Frame Protection Required), is a security policy that dictates whether ranging frames are required to be protected even without a formal association between the Initiating STA (ISTA) and Responding STA (RSTA)

Returns
boolean

isSecureHeLtfSupported

public boolean isSecureHeLtfSupported ()

Returns whether the AP supports secure HE-LTF for ranging measurement. Secure HE-LTF (High Efficiency Long Training Field), is a security enhancement for the HE PHY (High Efficiency Physical Layer) that aims to protect ranging measurements by using randomized HE-LTF sequences. This prevents attackers from exploiting predictable HE-LTF patterns. IEEE 802.11az adds secure HE-LTF support in Extended RSN capabilities.

Returns
boolean

isTwtResponder

Added in API level 35
public boolean isTwtResponder ()

Returns
boolean whether AP is Target Wake Time (TWT) Responder.

toString

Added in API level 1
public String toString ()

Returns a string representation of the object.

Returns
String a string representation of the object.