Open llioor opened 8 years ago
@hoerresb Any chance to get an answer please?
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?
I test ok. and I commented the following lines in file WifiWizard.java
// // // if(!displayLocationSettingsRequest()){ // callbackContext.error("Android 6 and above Gps turned off"); // } // // if(!checkCurrentPermissions()){ // callbackContext.error("permission not found") ; // }
I tested ok. and I commented the following lines in file WifiWizard.java
// // // if(!displayLocationSettingsRequest()){ // callbackContext.error("Android 6 and above Gps turned off"); // } // // if(!checkCurrentPermissions()){ // callbackContext.error("permission not found") ; // }
I tested ok. and I commented the following lines in file WifiWizard.java
// // // if(!displayLocationSettingsRequest()){ // callbackContext.error("Android 6 and above Gps turned off"); // } // // if(!checkCurrentPermissions()){ // callbackContext.error("permission not found") ; // }
hey, I've got the same issue here Nexus 5 with Android 6.0.1
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.
hey, this problem is solved?? I try run in android 6.x with turned GPS, and it didn't work... Any idea?
Just worked through this - manually enabling the Location permission as @digitalWestie mentioned made the networks show up.
The branch at https://github.com/paraggarg37/WifiWizard contains a check for GPS enable, but the app itself doesn't complain when Location is off. I'm going to try and use http://ionicframework.com/docs/v2/native/diagnostic/ to see if I can get a better indication of available services.
Well,I tried with xiaomi5. At first,I got an empty array as well.But when the access of using location and wifi is allowed ,I can get the correct list. Just like @emcniece says ,manually enable the access to location and wifi is necessary(default is ask when used).
You 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 call window.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
Confirmed that I needed to enable Location permissions in Android 6.0.1 to get getScanResults
to work. I now request these permissions programatically with cordova-plugin-android-permissions
@leitzsin360 That was pain before I got to know the fact..Thank you for saving my head..Pretty frustrating when there's no exception or things go normally without expected output..
@peeter-tomberg I'm trying to do what you described in your comment on Android version 7.0.0. However, I'm getting a "Permission permanently denied" response on the call to requestLocationAuthorization
. Did you encounter anything like that?
I also notice that the phone never prompts me to enable the permission. I'm currently testing my app using cordova run android
via USB debugging. I was also unable to find my app in the settings to manually enable the permissions. I suspect (thought I don't know for sure) I am being blocked by not having the app actually installed on my device, just debugging via cordova. Any ideas on what to check? Thank you.
@pflugs30 I just had the same problem. But I found my problem. I clickt "never show again". I fully deinstalled the app. Now the app ask again. Maybee this will help you.
To request the permission is only run diagnostic.requestLocationAuthorization()
You have to make sure that your app is using both coarse and fine location permissions and make sure that wifi "and GPS surprisingly" is turned on , that's an odd bug , but that's how things worked for me after couple of hours of trouble shooting
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:
Any ideas?