to top
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 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.
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.
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 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 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.

This is not normalized, but should be!

Returns
  • the RSSI, in the range ??? to ???

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