cordova-plugin-bluetoothle
cordova-plugin-bluetoothle copied to clipboard
Android 10, no devices detected during scan
Hello,
I deciced to switch on Android device but unfortunatly scann function resturn no devices: Initialization return "enable"scan return "scanStarted" but no devices found.
I use the following function: bluetoothle.startScan(startScanSuccess, handleError, { services: [] });
Any idea of what I did wrong ?
If I go in android bluetooth setup the device is detected and I can can pair it. The device has a passcode. Not sure if it can explain the issue.
I checked the XML file:
<config-file target="AndroidManifest.xml" parent="/manifest">
<uses-permission android:name="android.permission.BLUETOOTH"/>
<uses-permission android:name="android.permission.BLUETOOTH_ADMIN"/>
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
</config-file>
FINE_LOCATION is there.
Do you have the code example for your startScanSuccess function?
Here's the one I'm using. Same issue on Android 11 with SGH-I337M:
bluetoothle.startScan(function(s) { console.log("success"); console.log(s) }, function(e) { console.error(e) }, { services: []});
It doesn't find any devices. But if device is already paired, it works great. Previous calls were:
bluetoothle.initialize(function(r) { console.log(r) }, { request: true })
which returned {status: "enabled"}
I needed to do bluetoothle.requestPermission(requestPermissionSuccess, requestPermissionError); first!