Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Don't connect to any WIFI #43

Open
rimedar opened this issue Feb 2, 2021 · 1 comment
Open

Don't connect to any WIFI #43

rimedar opened this issue Feb 2, 2021 · 1 comment

Comments

@rimedar
Copy link

rimedar commented Feb 2, 2021

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.

@EvansPM
Copy link

EvansPM commented May 30, 2021

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;
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants