Open AbdulRahman577 opened 1 year ago
i am also facing the same issue i tried to fix it by changing the internal file also but still it not working please let me know if you have any solution for this
Same issue here
Hi!! I'm using the same package, this is the version: wifi_iot: ^0.3.19
. I am not trying to acces to internet because my app doesn't need it. But I can connect it to the network and in my case, transmit data over a socket. This is my code that manage this:
Future<InternetState> tryWiFiConnection() async {
try {
logger.i("Trying connection process, connecting with: ${Environment.ssid}");
final isConnected = await WiFiForIoTPlugin.findAndConnect(
Environment.ssid!,
password: Environment.password,
);
logger.i("WiFi connected: $isConnected");
if( !isConnected ) return InternetState.disconnected;
await WiFiForIoTPlugin.forceWifiUsage(true);
return InternetState.connected;
} on Exception catch (err) {
logger.e("Fatal error on try WiFi Connection: $err");
return InternetState.error;
}
}
Maybe it would work for you if you added: await WiFiForIoTPlugin.forceWifiUsage(true);
You can see it in the package documentation.
(iv) Will have to use forceWifiUsage(true) to route app traffic via connected access point, similarly can be disabled to route traffic via cellular network (for internet). This is not enabled by default and left upto to the user.
Hello Together, I'm working on Android 11 device which is POCO M2 Pro MIUI 12.5.6 Global version stable. I m developing app which is scanning the QR code to get WIFI credentials and then connect to those Wifi network. Wifi security type is WPA2. I m using qr scanner package and the wifi_iot package for connecting to the WiFi. When using the function, connectionstatus = await WiFiForIoTPlugin.findAndConnect(ssid, password: pwd );
It will connect to the network successfully but the internet access is not there. Then, I tried, connectionstatus = await WiFiForIoTPlugin.findAndConnect(ssid, password: pwd, withInternet: true); It does not even connecting to the network and debug console shows like below,
E/WifiIotPlugin( 4515): status: 0
It is quite same for the function Connect(),
I have used permission handler in run time for the location and also set everything in manifest file,
Please help me to find the solution.