pusherman / react-native-network-info

React Native library for getting information about the devices network
MIT License
351 stars 103 forks source link

getBSSID is not working in android PIE #68

Open yusuf987 opened 5 years ago

yusuf987 commented 5 years ago

i am using "react-native-network-info": "^3.2.2", my react version is "react": "16.0.0-beta.5", "react-native": "0.49.3",

i am using react-native-network-info to get network BSSID this was wasworking fine untill my user update thier Android OS to Android PIE

it always return 02:00:00:00:01:00 in android PIE devices

anyone has any idea about this

bbourdel commented 5 years ago

Hello, In fact, the plugins is not working on Android 9. The ssid is <unkwown ssid>, Any ideas

pusherman commented 5 years ago

I don't have a current android device to try to reproduce the error but have you tried resetting your network settings on your device?

bbourdel commented 5 years ago

Ok, I found some time to search this issue on Pie. The fact is, since Android Pie, the permission 'android.permission.ACCESS_COARSE_LOCATION' is need to have access to Wifi information.

As, I'm trying to solved it using https://facebook.github.io/react-native/docs/permissionsandroid. I will tell you as soon as finished to implem it.

Source : https://github.com/EspressifApp/EsptouchForAndroid/commit/f467e1ad4838bb924089c5e8c73bc9f9c08aba68

Joao-Leite commented 5 years ago

I've tried to add ACCESS_COARSE_LOCATION permission but I still get an error for BSSID and SSID. Did you have success with it?

westcode commented 5 years ago

This does fix the issue. Make sure to add it the the manifest as well as check runtime using PermissionAndroid.

<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
bbourdel commented 5 years ago

Also, you have to set your localisation active on your smartphone (turn GPS on).