lightbulb_outline Help shape the future of the Google Play Console, Android Studio, and Firebase. Start survey

WifiInfo

public class WifiInfo
extends Object implements Parcelable

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


Describes the state of any Wifi connection that is active or is in the process of being set up.

Summary

Constants

String FREQUENCY_UNITS

Frequency in MHz

String LINK_SPEED_UNITS

Link speed in Mbps

Inherited constants

Public methods

String getBSSID()

Return the basic service set identifier (BSSID) of the current access point.

static NetworkInfo.DetailedState getDetailedStateOf(SupplicantState suppState)

Map a supplicant state into a fine-grained network connectivity state.

int getFrequency()

Returns the current frequency in FREQUENCY_UNITS.

boolean getHiddenSSID()
int getIpAddress()
int getLinkSpeed()

Returns the current link speed in LINK_SPEED_UNITS.

String getMacAddress()
int getNetworkId()

Each configured network has a unique small integer ID, used to identify the network when performing operations on the supplicant.

int getRssi()

Returns the received signal strength indicator of the current 802.11 network, in dBm.

String getSSID()

Returns the service set identifier (SSID) of the current 802.11 network.

SupplicantState getSupplicantState()

Return the detailed state of the supplicant's negotiation with an access point, in the form of a SupplicantState object.

String toString()

Returns a string representation of the object.

Inherited methods

Constants

FREQUENCY_UNITS

added in API level 21
public static final String FREQUENCY_UNITS

Frequency in MHz

Constant Value: "MHz"

added in API level 1
public static final String LINK_SPEED_UNITS

Link speed in Mbps

Constant Value: "Mbps"

Public methods

getBSSID

added in API level 1
public String getBSSID ()

Return the basic service set identifier (BSSID) of the current access point. The BSSID may be null if there is no network currently connected.

Returns
String the BSSID, in the form of a six-byte MAC address: XX:XX:XX:XX:XX:XX

getDetailedStateOf

added in API level 1
public static NetworkInfo.DetailedState getDetailedStateOf (SupplicantState suppState)

Map a supplicant state into a fine-grained network connectivity state.

Parameters
suppState SupplicantState: the supplicant state

Returns
NetworkInfo.DetailedState the corresponding NetworkInfo.DetailedState

getFrequency

added in API level 21
public int getFrequency ()

Returns the current frequency in FREQUENCY_UNITS.

Returns
int the frequency.

See also:

getHiddenSSID

added in API level 1
public boolean getHiddenSSID ()

Returns
boolean true if this network does not broadcast its SSID, so an SSID-specific probe request must be used for scans.

getIpAddress

added in API level 1
public int getIpAddress ()

Returns
int

getLinkSpeed

added in API level 1
public int getLinkSpeed ()

Returns the current link speed in LINK_SPEED_UNITS.

Returns
int the link speed.

See also:

getMacAddress

added in API level 1
public String getMacAddress ()

Returns
String

getNetworkId

added in API level 1
public int getNetworkId ()

Each configured network has a unique small integer ID, used to identify the network when performing operations on the supplicant. This method returns the ID for the currently connected network.

Returns
int the network ID, or -1 if there is no currently connected network

getRssi

added in API level 1
public int getRssi ()

Returns the received signal strength indicator of the current 802.11 network, in dBm.

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

Returns
int the RSSI.

getSSID

added in API level 1
public String getSSID ()

Returns the service set identifier (SSID) of the current 802.11 network. If the SSID can be decoded as UTF-8, it will be returned surrounded by double quotation marks. Otherwise, it is returned as a string of hex digits. The SSID may be <unknown ssid> if there is no network currently connected, or if the caller has insufficient permissions to access the SSID. Prior to Build.VERSION_CODES.JELLY_BEAN_MR1, this method always returned the SSID with no quotes around it.

Returns
String the SSID

getSupplicantState

added in API level 1
public SupplicantState getSupplicantState ()

Return the detailed state of the supplicant's negotiation with an access point, in the form of a SupplicantState object.

Returns
SupplicantState the current SupplicantState

toString

added in API level 1
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.