public class WifiManager
extends java.lang.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,
java.lang.String passphrase)
Deprecated.
Use
join(AccessPoint, String, SecurityMode) instead. If you don't know the security mode
used, use SecurityMode.UNKNOWN. |
void |
join(AccessPoint accessPoint,
java.lang.String passphrase,
SecurityMode securityMode)
Joins a Wi-Fi network using a Wi-Fi access point, a passphrase and a security mode.
|
void |
join(java.lang.String SSID,
java.lang.String passphrase)
Joins a Wi-Fi network using a SSID and a passphrase.
|
void |
join(java.lang.String SSID,
java.lang.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 static WifiManager getInstance()
WifiManager instance.WifiManager instance.public void disableSoftAP()
throws java.io.IOException
java.io.IOException - if an I/O error occurspublic void enableSoftAP(SoftAPConfiguration configuration) throws java.io.IOException
configuration - SoftAP configuration.java.io.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 java.io.IOException
java.io.IOException - If an I/O error occurs.@Nullable public AccessPoint getJoined() throws java.io.IOException
null if no Wi-Fi access point has been joined yet.java.io.IOException - If an I/O error occurs.public boolean isSoftAPEnabled()
throws java.io.IOException
true if enabled, false otherwise.java.io.IOException - If an I/O error occurs.@Deprecated public void join(AccessPoint accessPoint, java.lang.String passphrase) throws java.io.IOException
join(AccessPoint, String, SecurityMode) instead. If you don't know the security mode
used, use SecurityMode.UNKNOWN.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.java.io.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.java.lang.IllegalArgumentException - if the accessPoint or the passphrase is null.public void join(AccessPoint accessPoint, java.lang.String passphrase, SecurityMode securityMode) throws java.io.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.java.io.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.java.lang.IllegalArgumentException - if the accessPoint or the passphrase is null.public void join(java.lang.String SSID,
java.lang.String passphrase)
throws java.io.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.java.io.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.java.lang.IllegalArgumentException - if the SSID or the passphrase is null.public void join(java.lang.String SSID,
java.lang.String passphrase,
SecurityMode securityMode)
throws java.io.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.java.io.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.java.lang.IllegalArgumentException - if the SSID or the passphrase is null.public void leave()
throws java.io.IOException
java.io.IOException - If an I/O error occurs.public AccessPoint[] scan() throws java.io.IOException
scan(true).java.io.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 java.io.IOException
active - true for an active scan, false for a passive scan.java.io.IOException - if the underlying network interface is currently stopped, scanning is not possible at the moment, or
an I/O error occurs.