cordova-plugin-bluetoothle icon indicating copy to clipboard operation
cordova-plugin-bluetoothle copied to clipboard

Android 10, no devices detected during scan

Open oxsmose opened this issue 4 years ago • 3 comments

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.

oxsmose avatar Mar 15 '21 16:03 oxsmose

Do you have the code example for your startScanSuccess function?

ab12gu avatar Jun 24 '21 04:06 ab12gu

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"}

grassick avatar Feb 15 '22 20:02 grassick

I needed to do bluetoothle.requestPermission(requestPermissionSuccess, requestPermissionError); first!

grassick avatar Feb 15 '22 20:02 grassick