WiFiFlutter
WiFiFlutter copied to clipboard
Autoconnection issue (does not switch from temporary connection to permanent connection.)
Hello , I am trying to connect a specific SSID when I open my app. But it stuck at temporary connection. So I cannot transfer data over it.
When I open my app it ask the following question.
I accept this and and it says connected. But when I look to WiFi settings from my phone, it look like the following pic.
When I click to actual one, It connect to actual one and temporary WiFi disaperar.
Has anyone experienced such a problem? Or can anyone help?
I tried many variantions of code but at the end , still same error. I am testing with Android 14
Thanks everyone.
My code like this:
` void _connectToWiFi() async { await WiFiForIoTPlugin.disconnect(); bool isConnected = await WiFiForIoTPlugin.connect( ssid, password: password, joinOnce: true, withInternet: false, security: NetworkSecurity.WPA, ); final res = await WiFiForIoTPlugin.forceWifiUsage(true);
if (isConnected) {
print("Connected to $ssid");
} else {
print("Failed to connect to $ssid");
}
}
@override Widget build(BuildContext context) { return Center( child: Text("Connecting to WiFi..."), ); } } `