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.
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
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.