Skip to content
This repository has been archived by the owner on Jan 14, 2025. It is now read-only.

Does not connect to specified network, no error #6

Open
pstanton opened this issue Sep 25, 2018 · 1 comment
Open

Does not connect to specified network, no error #6

pstanton opened this issue Sep 25, 2018 · 1 comment

Comments

@pstanton
Copy link

pstanton commented Sep 25, 2018

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.

@tadasr
Copy link
Owner

tadasr commented Jan 15, 2019

What android version are you using?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants