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

Not able to connect - NetworkCallback was already unregistered #387

Open
Shresthj opened this issue May 3, 2024 · 3 comments
Open

Not able to connect - NetworkCallback was already unregistered #387

Shresthj opened this issue May 3, 2024 · 3 comments

Comments

@Shresthj
Copy link

Shresthj commented May 3, 2024

here my code-

-------------------------------------------------------------------------

ssid = 'CELIUMWIFI'
password = 'CELIUMPASS'
Future _connectToWifi(ssid, pass) async {
try {
var detail = await WiFiForIoTPlugin.connect(ssid,
password: pass, security: NetworkSecurity.WPA);
print(detail);
} catch (e) {
print("Error connecting to WiFi: $e");
}
}

when i am try to connect with new ssid and password i am getting this type of error-

-------------------------------------------------------------------------

I/FA (31756): Application backgrounded at: timestamp_millis: 1714717238789
D/ConnectivityManager(31756): NetworkCallback was already unregistered
I/flutter (31756): false

@RishuRanjan25
Copy link

import 'package:wifi_for_iot/wifi_for_iot.dart';

Future _connectToWifi(String ssid, String password) async {
try {
var detail = await WiFiForIoTPlugin.connect(ssid,
password: password, security: NetworkSecurity.WPA);
if (detail) {
print("Connected to WiFi: $ssid");
} else {
print("Failed to connect to WiFi: $ssid");
}
} catch (e) {
print("Error connecting to WiFi: $e");
}
}

void main() {
String ssid = 'CELIUMWIFI';
String password = 'CELIUMPASS';

_connectToWifi(ssid, password);
}

@Shresthj
Copy link
Author

Shresthj commented May 3, 2024

@RishuRanjan25
where did you get this from-
import 'package:wifi_for_iot/wifi_for_iot.dart';

@websachinbansal
Copy link

websachinbansal commented Jun 3, 2024

code: Future connectToWifi(String ssid, String password) async {

try {
  var details = await WiFiForIoTPlugin.connect(ssid,
      password: password, security: NetworkSecurity.WPA, joinOnce: true);
  print('details are $details');
} catch (e) {
  print('fialed to connect $e');
}

}. getting'details are false' in debug console

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

3 participants