Added in API level 1

ScanResult

class ScanResult : Parcelable
kotlin.Any
   ↳ 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

information elements from beacon.

Constants
static Int

AP Channel bandwidth is 160 MHZ

static Int

AP Channel bandwidth is 20 MHZ

static Int

AP Channel bandwidth is 320 MHZ

static Int

AP Channel bandwidth is 40 MHZ

static Int

AP Channel bandwidth is 80 MHZ

static Int

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

static Int

Preamble type: EHT.

static Int

Preamble type: HE.

static Int

Preamble type: HT.

static Int

Preamble type: Legacy.

static Int

Preamble type: VHT.

static Int

The unspecified value.

static Int

Wi-Fi 2.

static Int

Wi-Fi 5 GHz band.

static Int

Wi-Fi 60 GHz band.

static Int

Wi-Fi 6 GHz band.

static Int

Wi-Fi 802.

static Int

Wi-Fi 802.

static Int

Wi-Fi 802.

static Int

Wi-Fi 802.

static Int

Wi-Fi 802.

static Int

Wi-Fi 802.

static Int

Wi-Fi unknown standard

Inherited constants
Public constructors

copy constructor

Construct an empty scan result.

Public methods
static Int

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

static Int

Utility function to convert frequency in MHz to channel number.

Int

Implement the Parcelable interface {@hide}

MutableList<MloLink!>

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

MacAddress?

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

Int

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

MutableList<ScanResult.InformationElement!>

Get all information elements found in the beacon.

IntArray

Get all the security types supported by this ScanResult.

WifiSsid?

The SSID of the access point.

Int

return the AP wifi standard.

Boolean

Boolean

String

Unit
writeToParcel(dest: Parcel, flags: Int)

Implement the Parcelable interface {@hide}

Properties
String!

The address of the access point.

static Parcelable.Creator<ScanResult!>

Implement the Parcelable interface

String!

The network name.

String!

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

Int

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)

Int

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)

Int

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 android.net.wifi.ScanResult#CHANNEL_WIDTH_20MHZ, android.net.wifi.ScanResult#CHANNEL_WIDTH_40MHZ, android.net.wifi.ScanResult#CHANNEL_WIDTH_80MHZ, android.net.wifi.ScanResult#CHANNEL_WIDTH_160MHZ, android.net.wifi.ScanResult#CHANNEL_WIDTH_80MHZ_PLUS_MHZ, or android.net.wifi.ScanResult#CHANNEL_WIDTH_320MHZ

Int

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

Int

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

CharSequence!

Indicates Passpoint operator name published by access point.

Long

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

CharSequence!

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

Constants

CHANNEL_WIDTH_160MHZ

Added in API level 23
static val CHANNEL_WIDTH_160MHZ: Int

AP Channel bandwidth is 160 MHZ

Value: 3

CHANNEL_WIDTH_20MHZ

Added in API level 23
static val CHANNEL_WIDTH_20MHZ: Int

AP Channel bandwidth is 20 MHZ

Value: 0

CHANNEL_WIDTH_320MHZ

Added in API level 33
static val CHANNEL_WIDTH_320MHZ: Int

AP Channel bandwidth is 320 MHZ

Value: 5

CHANNEL_WIDTH_40MHZ

Added in API level 23
static val CHANNEL_WIDTH_40MHZ: Int

AP Channel bandwidth is 40 MHZ

Value: 1

CHANNEL_WIDTH_80MHZ

Added in API level 23
static val CHANNEL_WIDTH_80MHZ: Int

AP Channel bandwidth is 80 MHZ

Value: 2

CHANNEL_WIDTH_80MHZ_PLUS_MHZ

Added in API level 23
static val CHANNEL_WIDTH_80MHZ_PLUS_MHZ: Int

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

Value: 4

PREAMBLE_EHT

Added in API level 33
static val PREAMBLE_EHT: Int

Preamble type: EHT.

Value: 4

PREAMBLE_HE

Added in API level 33
static val PREAMBLE_HE: Int

Preamble type: HE.

Value: 3

PREAMBLE_HT

Added in API level 33
static val PREAMBLE_HT: Int

Preamble type: HT.

Value: 1

PREAMBLE_LEGACY

Added in API level 33
static val PREAMBLE_LEGACY: Int

Preamble type: Legacy.

Value: 0

PREAMBLE_VHT

Added in API level 33
static val PREAMBLE_VHT: Int

Preamble type: VHT.

Value: 2

UNSPECIFIED

Added in API level 31
static val UNSPECIFIED: Int

The unspecified value.

Value: -1

WIFI_BAND_24_GHZ

Added in API level 31
static val WIFI_BAND_24_GHZ: Int

Wi-Fi 2.4 GHz band.

Value: 1

WIFI_BAND_5_GHZ

Added in API level 31
static val WIFI_BAND_5_GHZ: Int

Wi-Fi 5 GHz band.

Value: 2

WIFI_BAND_60_GHZ

Added in API level 31
static val WIFI_BAND_60_GHZ: Int

Wi-Fi 60 GHz band.

Value: 16

WIFI_BAND_6_GHZ

Added in API level 31
static val WIFI_BAND_6_GHZ: Int

Wi-Fi 6 GHz band.

Value: 8

WIFI_STANDARD_11AC

Added in API level 30
static val WIFI_STANDARD_11AC: Int

Wi-Fi 802.11ac

Value: 5

WIFI_STANDARD_11AD

Added in API level 31
static val WIFI_STANDARD_11AD: Int

Wi-Fi 802.11ad

Value: 7

WIFI_STANDARD_11AX

Added in API level 30
static val WIFI_STANDARD_11AX: Int

Wi-Fi 802.11ax

Value: 6

WIFI_STANDARD_11BE

Added in API level 33
static val WIFI_STANDARD_11BE: Int

Wi-Fi 802.11be

Value: 8

WIFI_STANDARD_11N

Added in API level 30
static val WIFI_STANDARD_11N: Int

Wi-Fi 802.11n

Value: 4

WIFI_STANDARD_LEGACY

Added in API level 30
static val WIFI_STANDARD_LEGACY: Int

Wi-Fi 802.11a/b/g

Value: 1

WIFI_STANDARD_UNKNOWN

Added in API level 30
static val WIFI_STANDARD_UNKNOWN: Int

Wi-Fi unknown standard

Value: 0

Public constructors

ScanResult

Added in API level 1
ScanResult(source: ScanResult)

copy constructor

Parameters
source ScanResult: This value cannot be null.

ScanResult

Added in API level 1
ScanResult()

Construct an empty scan result.

Public methods

convertChannelToFrequencyMhzIfSupported

Added in API level 31
static fun convertChannelToFrequencyMhzIfSupported(
    channel: Int,
    band: Int
): Int

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 android.net.wifi.ScanResult#UNSPECIFIED, android.net.wifi.ScanResult#WIFI_BAND_24_GHZ, android.net.wifi.ScanResult#WIFI_BAND_5_GHZ, android.net.wifi.ScanResult#WIFI_BAND_6_GHZ, or android.net.wifi.ScanResult#WIFI_BAND_60_GHZ
Return
Int center frequency in Mhz of the channel, UNSPECIFIED if no match

convertFrequencyMhzToChannelIfSupported

Added in API level 31
static fun convertFrequencyMhzToChannelIfSupported(freqMhz: Int): Int

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

Parameters
freqMhz Int: frequency in MHz
Return
Int channel number associated with given frequency, UNSPECIFIED if no match

describeContents

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
Added in API level 33
fun getAffiliatedMloLinks(): MutableList<MloLink!>

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

Return
MutableList<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
fun getApMldMacAddress(): MacAddress?

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

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

getApMloLinkId

Added in API level 33
fun getApMloLinkId(): Int

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.

Return
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
fun getInformationElements(): MutableList<ScanResult.InformationElement!>

Get all information elements found in the beacon.

Return
MutableList<ScanResult.InformationElement!> This value cannot be null.

getWifiSsid

Added in API level 33
fun getWifiSsid(): WifiSsid?

The SSID of the access point.

Return
WifiSsid? This value may be null.

is80211mcResponder

Added in API level 23
fun is80211mcResponder(): Boolean

isPasspointNetwork

Added in API level 23
fun isPasspointNetwork(): Boolean

toString

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

writeToParcel

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

Added in API level 1
var BSSID: String!

The address of the access point.

CREATOR

Added in API level 30
static val CREATOR: Parcelable.Creator<ScanResult!>

Implement the Parcelable interface

SSID

Added in API level 1
Deprecated in API level 33
var SSID: String!

Deprecated: Use getWifiSsid() instead.

The network name.

capabilities

Added in API level 1
var capabilities: String!

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

centerFreq0

Added in API level 23
var centerFreq0: Int

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
var centerFreq1: Int

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
var frequency: Int

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
var level: Int

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

Use android.net.wifi.WifiManager#calculateSignalLevel 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
var operatorFriendlyName: CharSequence!

Deprecated: - Use WifiInfo#getPasspointProviderFriendlyName()

Indicates Passpoint operator name published by access point.

timestamp

Added in API level 17
var timestamp: Long

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

venueName

Added in API level 23
Deprecated in API level 31
var venueName: CharSequence!

Deprecated: - 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.