react-native-network-info icon indicating copy to clipboard operation
react-native-network-info copied to clipboard

Android 9 always returns <unknown ssid>

Open ratman841 opened this issue 5 years ago • 3 comments

On a Android device with version 9.0.0, the function NetworkInfo.getSSID() always returns <unknown ssid>

The same code works without issues on a Android 8.x.x device

Is this a known bug?

ratman841 avatar Oct 09 '19 14:10 ratman841

You can add <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" /> to AndroidManifest.xml, and then you need to add PermissionsAndroid.request(PermissionsAndroid.PERMISSIONS.ACCESS_FINE_LOCATION); , maybe it can help you get correct ssid

ppdbxdawj avatar Oct 11 '19 06:10 ppdbxdawj

You can add <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" /> to AndroidManifest.xml, and then you need to add PermissionsAndroid.request(PermissionsAndroid.PERMISSIONS.ACCESS_FINE_LOCATION); , maybe it can help you get correct ssid

I can confirm this works. it may related to Android 9's changes, you will need to request location permission to get wifi ssid.

iamcxa avatar Oct 11 '19 06:10 iamcxa

You can add <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" /> to AndroidManifest.xml, and then you need to add PermissionsAndroid.request(PermissionsAndroid.PERMISSIONS.ACCESS_FINE_LOCATION); , maybe it can help you get correct ssid

I can confirm this works. it may related to Android 9's changes, you will need to request location permission to get wifi ssid.

Agreed But with this you will also have to enable your location while using the application as only then will the data be loaded. Also I think this issue should be closed as it is more of a trouble with versions of Android and not this package

NightWing1998 avatar Dec 16 '19 17:12 NightWing1998