react-native-iot-wifi
react-native-iot-wifi copied to clipboard
Does not connect to specified network, no error
Android:
In a loop with a 30 second delay I am doing:
let current = await new Promise((resolve, reject) => {
Wifi.getSSID(_current => {
resolve(_current);
});
});
let ssid = this.getSsid();
if (current == ssid) {
console.log("WIFI2", "already connected", current);
return;
}
let connected;
try {
connected = await new Promise((resolve, reject) => {
Wifi.connect(ssid,
error => {
if (error) reject(error);
resolve(true);
}
);
});
console.log("WIFI2", "connected", connected, ssid);
} catch (error) {
console.log("WIFI2", "current error", error);
return;
}
Where ssid = "networkB"
the logs show the following continuously.
WIFI2 available true
WIFI2 current networkA
WIFI2 connected true networkB
WIFI2 available true
WIFI2 current networkA
WIFI2 connected true networkB
I've tested another library which works fine.
What android version are you using?