Android APIs
public class

WifiInfo

extends Object
implements Parcelable
java.lang.Object
   ↳ android.net.wifi.WifiInfo

Class Overview

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
[Expand]
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 containing a concise, human-readable description of this object.
[Expand]
Inherited Methods
From class java.lang.Object
From interface android.os.Parcelable

Constants

public static final String FREQUENCY_UNITS

Added in API level 21

Frequency in MHz

Constant Value: "MHz"

public static final String LINK_SPEED_UNITS

Added in API level 1

Link speed in Mbps

Constant Value: "Mbps"

Public Methods

public String getBSSID ()

Added in API level 1

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
  • the BSSID, in the form of a six-byte MAC address: XX:XX:XX:XX:XX:XX

public static NetworkInfo.DetailedState getDetailedStateOf (SupplicantState suppState)

Added in API level 1

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

Parameters
suppState the supplicant state
Returns

public int getFrequency ()

Added in API level 21

Returns the current frequency in FREQUENCY_UNITS.

Returns
  • the frequency.
See Also

public boolean getHiddenSSID ()

Added in API level 1

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

public int getIpAddress ()

Added in API level 1

public int getLinkSpeed ()

Added in API level 1

Returns the current link speed in LINK_SPEED_UNITS.

Returns
  • the link speed.
See Also

public String getMacAddress ()

Added in API level 1

public int getNetworkId ()

Added in API level 1

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
  • the network ID, or -1 if there is no currently connected network

public int getRssi ()

Added in API level 1

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
  • the RSSI.

public String getSSID ()

Added in API level 1

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
  • the SSID

public SupplicantState getSupplicantState ()

Added in API level 1

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

Returns

public String toString ()

Added in API level 1

Returns a string containing a concise, human-readable description of this object. Subclasses are encouraged to override this method and provide an implementation that takes into account the object's type and data. The default implementation is equivalent to the following expression:

   getClass().getName() + '@' + Integer.toHexString(hashCode())

See Writing a useful toString method if you intend implementing your own toString method.

Returns
  • a printable representation of this object.