flutternetwork / WiFiFlutter

Flutter plugin suite for various WiFi services.
https://wifi.flutternetwork.dev
289 stars 182 forks source link

[wifi_iot] WiFiForIoTPlugin.connect() #372

Closed Bojan227 closed 8 months ago

Bojan227 commented 8 months ago
Future<bool> handleDeviceConnection(ConnectionInfoDto connectionInfoDto) async {
  log('connect the device');

  final register = await WiFiForIoTPlugin.registerWifiNetwork(
    connectionInfoDto.ssid,
    security: NetworkSecurity.NONE,
  );

  log('$register - register');

  final response = await WiFiForIoTPlugin.connect(
    connectionInfoDto.ssid,
    joinOnce: true,
    security: NetworkSecurity.NONE,
    withInternet: false,
  );

  log("$response connection to the device");
  if (!response) {
    return false;
  } else {
    return await WiFiForIoTPlugin.forceWifiUsage(true);
  }
}

After await WiFiForIoTPlugin.connect is called a native andorid modal is present with the device being shown, but why does the call keep getting repeated unless I click connect or cancel. If I click connect after 2-3 seconds there will be another modal being shown that can destroy my app flow. Any ideas on how to handle this? wifi_iot

nari2442 commented 8 months ago

Same Issue here how to block those default popups? any body have any idea? is it possible or not?

Bojan227 commented 8 months ago

Same Issue here how to block those default popups? any body have any idea? is it possible or not?

@nari2442 findAndConnect() seems to work for the popups, I might have some bug in my code that triggering a second call for the method.

nari2442 commented 8 months ago

@Bojan227 oh is it?? i think i already tried that as well but still getting those popups .

Bojan227 commented 8 months ago

@Bojan227 oh is it?? i think i already tried that as well but still getting those popups .

@nari2442 I'm not sure i switched to findAndConnect() and it doesn't show any popups now, I'm using Android 14.