WifiWizard: getScanResults not working on Nexus 5 with Android 6.0.1
Hi, The plugin works wonderfully (setWifiEnabled, addNetwork, connectNetwork, disconnectNetwork, etc.)
startScan calls the success callback, but getScanResults always calls the success callback with an empty array.
we have used an androidManifest with the following pemissions:
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
<uses-permission android:name="android.permission.CHANGE_WIFI_STATE" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
Any ideas?
About this issue
- Original URL
- State: open
- Created 8 years ago
- Comments: 17
OK, I turned my GPS on and it didn’t work. But when I went into Settings -> App -> My App -> Permissions and allowed location it worked. Very odd one.
Confirmed that I needed to enable Location permissions in Android 6.0.1 to get
getScanResultsto work. I now request these permissions programatically withcordova-plugin-android-permissionsYou have to ask for permissions at runtime. I used the plugin https://github.com/dpa99c/cordova-diagnostic-plugin to achieve this. Before calling
getScanResults, I callwindow.cordova.plugins.diagnostic.requestLocationAuthorization(successCallback, errorCallback);Please note that successCallback does not mean the user granted you permissions, it might also mean the user denied your permission. Read more at: https://github.com/dpa99c/cordova-diagnostic-plugin#requestlocationauthorization
AFTER enable GPS .it is ok. Its a bug in Andorid 6+
Even with GPS enabled it is not working… getScanResults still calls the success callback with an empty array. Any advice?