Quantcast
Channel: Active questions tagged react-native+ios - Stack Overflow
Viewing all articles
Browse latest Browse all 16563

react-native netinfo behaving strange in ios

$
0
0

System Environment:

OS: Windows 10 OS 64 bit CPU: Intel core i7-9700k @ 3.60GHz Memory: 550.87 MB / 16.00 GB

Platforms:

Issue related to both Android and IOS

Versions :

Android: 9 iOS: 13.1.3 react-native-netinfo: 5.0.0 react-native: 0.59.8 expo: 36.0.0

Description :

In my expo project i need details like ssid , ipAddress of WiFi to which current phone is connected. i followed below procedure as follows :

first step i did npm install --save @react-native-community/netinfo

second step i imported NetInfo from “@react-native-community/netinfo”;

third step i wrote below code

NetInfo.fetch().then(state => {
                console.log(“Connection type”, state.type);
                console.log(“Isconnected?”, state.isConnected);
                console.log("Details ", state.detail);
                });

following is the output i can see on my terminal

Output in-case of Android

Connection type wifi

Is connected? true
Detail? Object {
    “ipAddress”: “192.168.0.171”,
    “isConnectionExpensive”: false,
    “ssid”: "DM",
    “subnet”: “255.255.255.0”,
}

Output in-case of iOS.

Is connected? true
Detail? Object {
    “ipAddress”: “192.168.0.171”,
    “isConnectionExpensive”: false,
    “ssid”: null,
    “subnet”: “255.255.255.0”,
}

So if you see in output Details i get all the detalis like ssid, subnet for Android but incase of iOS ssid is always null even after giving location permission. As i am newbie to react native i don’t understand where did i do mistake because of which i am not getting wiFi ssid and ipaddress. Please give me a solution for the above mentioned problem. I dont want to eject from Expo.


Viewing all articles
Browse latest Browse all 16563

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>