react-native-iot-wifi icon indicating copy to clipboard operation
react-native-iot-wifi copied to clipboard

Does not connect to specified network, no error

Open pstanton opened this issue 5 years ago • 1 comments

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.

pstanton avatar Sep 25 '18 02:09 pstanton

What android version are you using?

tadasr avatar Jan 15 '19 15:01 tadasr