public class WifiManager extends Object
| Constructor and Description |
|---|
WifiManager() |
| Modifier and Type | Method and Description |
|---|---|
void |
disableSoftAP()
Disables the Software enabled Access Point (SoftAP).
|
void |
enableSoftAP(SoftAPConfiguration configuration)
Enables the SoftAP with a given configuration.
|
WifiCapability |
getCapability()
Gets the Wi-Fi capability of the platform.
|
static WifiManager |
getInstance()
Returns the
WifiManager instance. |
AccessPoint |
getJoined()
Gets the currently joined Wi-Fi access point.
|
boolean |
isSoftAPEnabled()
Tells whether if SoftAP is currently enabled.
|
void |
join(AccessPoint accessPoint,
String passphrase,
SecurityMode securityMode)
Joins a Wi-Fi network using a Wi-Fi access point, a passphrase and a security mode.
|
void |
join(String SSID,
String passphrase)
Joins a Wi-Fi network using a SSID and a passphrase.
|
void |
join(String SSID,
String passphrase,
SecurityMode securityMode)
Joins a wireless network using an SSID and a passphrase.
|
void |
leave()
Leaves the currently joined Wi-Fi access point.
|
AccessPoint[] |
scan()
Performs an active scan of available Wi-Fi access points.
|
AccessPoint[] |
scan(boolean active)
Performs a scan of available access points.
|
public void disableSoftAP()
throws IOException
IOException - if an I/O error occurspublic void enableSoftAP(SoftAPConfiguration configuration) throws IOException
configuration - SoftAP configuration.IOException - if SoftAP mode is not supported, an access point is currently joined and the platform does support
simultaneous mode (leave() must be called before this method) or an I/O error occurs.public WifiCapability getCapability() throws IOException
IOException - If an I/O error occurs.public static WifiManager getInstance()
WifiManager instance.WifiManager instance.@Nullable public AccessPoint getJoined() throws IOException
null if no Wi-Fi access point has been joined yet.IOException - If an I/O error occurs.public boolean isSoftAPEnabled()
throws IOException
true if enabled, false otherwise.IOException - If an I/O error occurs.public void join(AccessPoint accessPoint, String passphrase, SecurityMode securityMode) throws IOException
accessPoint - Wi-Fi access point.passphrase - Wi-Fi access point passphrase. The passphrase must be a sequence of between 8 and 64 ASCII-encoded
characters.securityMode - Wi-Fi access point security mode.IOException - if client mode is not supported, the SoftAP is currently enabled and the platform does support
simultaneous mode ( disableSoftAP() must be called before this method), or an I/O error
occurs.IllegalArgumentException - if the accessPoint or the passphrase is null.public void join(String SSID, String passphrase) throws IOException
SSID - Wi-Fi access point Service Set Identifier (SSID).passphrase - Wi-Fi access point passphrase. The passphrase must be a sequence of between 8 and 64 ASCII-encoded
characters.IOException - if client mode is not supported, the SoftAP is currently enabled and the platform does support
simultaneous mode ( disableSoftAP() must be called before this method), or an I/O error
occurs.IllegalArgumentException - if the SSID or the passphrase is null.public void join(String SSID, String passphrase, SecurityMode securityMode) throws IOException
SSID - Wi-Fi access point Service Set Identifier (SSID).passphrase - Wi-Fi access point passphrase. The passphrase must be a sequence of between 8 and 64 ASCII-encoded
characters.securityMode - Wi-Fi access point security mode.IOException - if client mode is not supported, the SoftAP is currently enabled and the platform does support
simultaneous mode ( disableSoftAP() must be called before this method), or an I/O error
occurs.IllegalArgumentException - if the SSID or the passphrase is null.public void leave()
throws IOException
IOException - If an I/O error occurs.public AccessPoint[] scan() throws IOException
scan(true).IOException - if the underlying Wi-Fi network interface is currently stopped, scanning is not possible at the
moment, or an I/O error occurs.public AccessPoint[] scan(boolean active) throws IOException
active - true for an active scan, false for a passive scan.IOException - if the underlying network interface is currently stopped, scanning is not possible at the moment, or
an I/O error occurs.