WiFiFlutter icon indicating copy to clipboard operation
WiFiFlutter copied to clipboard

Failed to connect

Open appbucket0408 opened this issue 1 year ago • 2 comments

this is my code: Future connectToWifi(String ssid) async { try { var details = await WiFiForIoTPlugin.connect(ssid, security: NetworkSecurity.NONE, joinOnce: true); print('details are $details'); if (details) { print('connected sucessfuly'); } else { print('failed to connect'); } } catch (e) { print('fialed to connect $e'); } }these are messages in debug console:D/ConnectivityManager(11147): NetworkCallback was already unregistered I/flutter (11147): details are false I/flutter (11147): failed to connect

appbucket0408 avatar Jun 04 '24 04:06 appbucket0408

Same problem here

spartakos87 avatar Jun 12 '24 12:06 spartakos87

We encounter the exact same issue. The very first time it always fails to connect. Retrying after that always succeeds. Haven't look into the source, but is 100% reproducable, so shouldn't be hard to fix (but currently don't have the time to look into it). By the way, this is the connect with "withInternet" set to false and "joinOnce" set to true, using WPA and specifying a bssid.

final bool connected = await WiFiForIoTPlugin.connect(
  accessPoint.ssid,
  bssid: accessPoint.bssid,
  security: NetworkSecurity.WPA,
  password: accessPointPassword,
  // withInternet: false,
  // joinOnce: true,
); 

Mark-Toten avatar Feb 28 '25 14:02 Mark-Toten