cordova-plugin-ble-central
cordova-plugin-ble-central copied to clipboard
startScan fails silently if location services are disabled
As per https://github.com/don/cordova-plugin-ble-central/blob/f5569e48262da901ee3b82b81ade3c73c5418f8b/src/android/BLECentralPlugin.java#L712
This should fail the scan callback so the calling app understands that the scanning is not in progress.
Seems there's a bit of history around this behaviour
- https://github.com/don/cordova-plugin-ble-central/pull/633
- https://github.com/don/cordova-plugin-ble-central/issues/607
- https://github.com/don/cordova-plugin-ble-central/pull/595
Any solution here will need to figure out how to determine whether the scan might work or not...
Any updates on this? If global permissions on Android are disabled, no error is thrown from isEnabled() or startScan()
Hi @sam-higgs
Nothing specific yet. The linked discussions above suggest there are some phones out there that are allowed to scan despite the location service being disabled, so I'm reluctant to force it one way or another.
In practice, this is something the application itself can do by checking ble.isLocationEnabled manually before starting a scan: https://github.com/don/cordova-plugin-ble-central#islocationenabled
But... it's still on my radar!