WifiManager.wps()
#
DescriptionThe wps method is used to handle a WPS connection with networks supporting that feature.
A network supporting a WPS connection has the string WPS available within the WifiManager.capabilities Array.
A WPS connection is a simpler way to connect a device to a network. It requires less knowledge from the user and makes things easier for him. Basically, when a user has a WPS-enabled WiFi router, he can choose that method to connect his device to the network instead of typing its password.
There are two ways of initiating a WPS connection up to the user:
The easiest one is by pressing a dedicated button on the WiFi router.
An alternative is by entering a PIN number provided by the WiFi router. There are two use cases here:
The WiFi router will send a PIN number to the device and the user has to type it on the WiFi router interface.
The WiFi router expects the user to type a PIN number on his device (usually, such a PIN number is displayed on the WiFi router itself).
#
Syntax#
Parametersparam A configuration object with the following properties:
method
: A string, one of the following:cancel
to abort a WPS connection attempt.pbs
to try a connection by pushing the physical button on the WiFi router.pin
to try a connection with a pin number.
bssid
: A string representing the bssid of the network to connect to. It is mandatory if the method property is set to pin.pin
: A string representing the pin number typed by the user. It is mandatory if the method property is set to pin and the user had to type the pin on his device.
#
ReturnsIt returns a DOMRequest to handle the success or error of the operation.
When the method property is set to pin, if the operation is successful and if the user must type a pin number on his WiFi router interface, the request's result is a string representing the PIN number to type.