Closed JayChiuTW closed 4 years ago
After the mobile phone has been updated to the first version, the SSID of the WIFI can't be obtained normally. Every time it is returned to Wi-Fi, how to solve the problem?
You need to ask for user location for getting wifi-ssid in ios 13. Use react native geolocation (https://facebook.github.io/react-native/docs/geolocation.html).
it's work only on iphone 6s, ip 6splus, on ip7, wifi ssid still return nill althought location permission is Always. Anyone check this on ip 7 ? Thanks !
Same problem on iPhone6S. I have added Geolocation and asked for permissions which is granted.
Finally got it to work by updating iOS13 to the very last release :)
@nik-garg I did what you said. I successfully got SSID on the IOS13 system. Thank you very much.
I did as you said and it doesn't run into the console.log function
Geolocation.requestAuthorization();
NetworkInfo.getSSID(ssid => {
console.log(ssid); // not woking
NetworkInfo.getBSSID(bssid => {
if (bssid != "error") {
self.setState({ bssidWifi: bssid });
}
self._getListWifi(ssid, bssid);
});
if (ssid != "error") {
self.setState({ ssidWifi: ssid });
} else {
Toast.show({
text: "Bạn chưa kết nối tới wifi",
type: "warning"
});
}
});
Thanks you!
@daihieptn97 it looks like the NetworkInfo.getSSID function now returns a promise rather than taking a callback argument so your code should now be like:
NetworkInfo.getSSID().then(ssid => {…})
or
let ssid = await NetworkInfo.getSSID()
this caught me out too
@daihieptn97 it looks like the NetworkInfo.getSSID function now returns a promise rather than taking a callback argument so your code should now be like:
NetworkInfo.getSSID().then(ssid => {…})
or
let ssid = await NetworkInfo.getSSID()
this caught me out too
thanks you so much !
let ssid = await NetworkInfo.getSSID(); or NetworkInfo.getSSID().then(ssid => {…}) ssid return undefined, why?
@shengliZh Add the permission in Info.plist ( key : "NSLocationWhenInUseUsageDescription" )
I have added this permission, but still get ssid undefined, what should I do?@JayChiuTW
I have added this permission, but still get ssid undefined, what should I do?@JayChiuTW
This won't work in a virtual device. Test this in an actual device.
I've added the permission in info.plist, granted location authorization, turned on Allow Wifi Information, and getSSID()
returns undefined for me.
iPhone 7 Plus iOS 13.2 React Native 0.55.4 React Native Network Info 5.2.1
According to this post : https://stackoverflow.com/questions/58072820/how-to-get-current-network-information-for-a-given-network-interface-on-ios-13 You need to reboot the device. Worked for me. Not sure it has to do with the package, more with iOS13 itself
@memelie that worked, thanks!
After the mobile phone has been updated to the first version, the SSID of the WIFI can't be obtained normally. Every time it is returned to Wi-Fi, how to solve the problem?