'How to display WiFi network (SSID) list on react native app using expo?
Solution 1:[1]
use this library and this the code give you (SSID) list
getWifiNetworksOnPress(){
wifi.loadWifiList((wifiStringList) => {
console.log(wifiStringList);
var wifiArray = JSON.parse(wifiStringList);
console.log(wifiArray);
},
(error) => {
console.log(error);
}
);
}
but in Android Api >25 you must be granted the ACCESS_COARSE_LOCATION (or ACCESS_FINE_LOCATION) permission in order to obtain results.
Solution 2:[2]
I'm also facing this issue. But now I have got a Library that solves my problem.
Just visit [react-native-wifi-reborn][1].
Usage
import WifiManager from "react-native-wifi-reborn";
WifiManager.connectToProtectedSSID(ssid, password, isWep).then(
() => {
console.log("Connected successfully!");
},
() => {
console.log("Connection failed!");
}
);
WifiManager.getCurrentWifiSSID().then(
ssid => {
console.log("Your current connected wifi SSID is " + ssid);
},
() => {
console.log("Cannot get current SSID!");
}
);
I hope it will work. [1]: https://www.npmjs.com/package/react-native-wifi-reborn
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | |
| Solution 2 | Talha Akbar |

