wifi
wifi copied to clipboard
Don't connect to any WIFI
I can list the available WIFI, but i cant connect to any red, the first time that press the Connection button, the app didn't do anything, flutter don't show error, but the second time that the Connection button is pressed i get this exception "PlatformException (PlatformException(already_active, wifi is already active, null))"
, but the wifi is not active and is not connected. That happen with all wifi that i try to connect, in Android 9.
It works only if I am connected to a wifi network, and I connect to another, but if I am not connected to any network, it does not work.
I came to the same conclusion. Probably if disconnect feature exist would help. In my case i check if wifi not enabled if not activate it then connect to a wifi. After the error occur when try to connect a second time it work, so i do this:
connectMyWifi(){
try {
var result = await Wifi.connection(_SSID, _PASSWORD);
} on PlatformException catch (e) {
if(e.code == 'already_active'){
result = await Wifi.connection(_SSID, _PASSWORD);
}
}
return result;
}