Most visited

Recently visited

Added in API level 1

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

From interface android.os.Parcelable

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

From class java.lang.Object
From interface android.os.Parcelable

Constants

FREQUENCY_UNITS

Added in API level 21
String FREQUENCY_UNITS

Frequency in MHz

Constant Value: "MHz"

LINK_SPEED_UNITS

Added in API level 1
String LINK_SPEED_UNITS

Link speed in Mbps

Constant Value: "Mbps"

Public methods

getBSSID

Added in API level 1
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
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
int getFrequency ()

Returns the current frequency in FREQUENCY_UNITS.

Returns
int the frequency.

See also:

getHiddenSSID

Added in API level 1
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
int getIpAddress ()

Returns
int

getLinkSpeed

Added in API level 1
int getLinkSpeed ()

Returns the current link speed in LINK_SPEED_UNITS.

Returns
int the link speed.

See also:

getMacAddress

Added in API level 1
String getMacAddress ()

Returns
String

getNetworkId

Added in API level 1
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
int getRssi ()

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

Use 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
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.

Returns
String the SSID

getSupplicantState

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

Hooray!