All scan functions can not run well in android and ios
See original GitHub issueIn android that called fail and got nothing; In ios that called fail and got “Not supported”.
And this is my testing code in my project.
let WifiWizard2 = require('WifiWizard2') WifiWizard2.getConnectedBSSID((data) => { console.log('getConnectedBSSID 1', data) }, (data) => { console.log('getConnectedBSSID 0', data) }) WifiWizard2.getConnectedBSSIDAsync().then((data) => { console.log('getConnectedSSIDAsync 1', data) }).catch((data) => { console.log('getConnectedSSIDAsync 0', data) }) WifiWizard2.scan((data) => { console.log('scan 1', data) }, (data) => { console.log('scan 0', data) }); (async () => { try { let data = await WifiWizard2.scanAsync() console.log('scanAsync 1', data) } catch (e) { console.log('scanAsync 0', 0) } })() WifiWizard2.listNetworks((data) => { console.log('listNetworks 1', data) }, (data) => { console.log('listNetworks 0', data) }) WifiWizard2.startScan((data) => { console.log('startScan 1', data, WifiWizard2.startScanAsync(), WifiWizard2.getScanResults((data2) => { console.log('getScanResults 1', data2) }, (data2) => { console.log('getScanResults 0', data2) })) }, (data) => { console.log('startScan 0', data) })
Issue Analytics
- State:
- Created 6 years ago
- Comments:5 (1 by maintainers)
Top GitHub Comments
You need to request location permission for the scan to return results. I worked on an application last night targeted for Android and the scan returned results without any issues.
One issue I did find was the missing requestPermission method mentioned in the docs. This doesn’t seem to be present in the Cordova plugin. I ended up using Ionic-Native Permissions (https://ionicframework.com/docs/native/android-permissions) to request “ACCESS_FINE_LOCATION” and everything works as expected.
On Mar 6, 2018 7:47 PM, “drunker” notifications@github.com wrote:
@drunker please try using the 3.0.0 branch which has the permission request handling built-in to it, you can find that branch here: https://github.com/tripflex/WifiWizard2/tree/3.0.0
It’s a completely different README so make sure to read through it to get an understanding of it, but you can either call the JS helper function to request perms, or when you call a JS helper function that requires that permission it will automatically request it
Unfortunately I do not have an iPhone so I don’t really have any way of testing the iOS related stuff
There’s already an open issue related to the iOS scan so i’m closing this ticket for now https://github.com/tripflex/WifiWizard2/issues/6