Ir al contenido

Más visitados

Visitados recientemente

navigation

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
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, or if the caller has insufficient permissions to access the SSID. Prior to JELLY_BEAN_MR1, this method always returned the SSID with no quotes around it.

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.

Este sitio usa cookies para almacenar tus preferencias específicas de idioma y visualización.

Obtén las noticias y sugerencias más recientes para programadores de Android, que te ayudarán a lograr el éxito en Google Play.

* Campos obligatorios

¡Muy bien!

Sigue a Google Developers en WeChat

¿Deseas explorar este sitio en ?

Solicitaste ver la página en , pero tu preferencia de idioma actual para este sitio es .

¿Quieres cambiar tu preferencia de idioma y explorar este sitio en ? Si deseas cambiarla en otro momento, usa el menú de idioma que se encuentra en la parte inferior de cada página.

Esta clase requiere un nivel de API igual o superior a

El documento está oculto porque el nivel de API que seleccionaste para la documentación es . Puedes cambiar el nivel de API de la documentación con el selector que está sobre el menú de navegación izquierdo.

Para obtener más información sobre cómo especificar el nivel de API que requiere tu app, consulta el artículo sobre Compatibilidad con diferentes versiones de la plataforma.

Take a short survey?
Help us improve the Android developer experience. (April 2018 — Developer Survey)