don / cordova-plugin-ble-central

Bluetooth Low Energy (BLE) Central plugin for Apache Cordova (aka PhoneGap)
Apache License 2.0
941 stars 601 forks source link

Some BLE not found #979

Closed valeprog closed 11 months ago

valeprog commented 11 months ago

I have been using the plugin for some years without problems, now since I updated to the latest version with the scan I no longer see some BLEs, while if I reinstall my previous app I find them correctly

valeprog commented 11 months ago

UPGRADE if I install new app on a smartphone with old Android system, all Beacon are found...

peitschie commented 11 months ago

Hi @valeprog

Android 12+ scans will filter out beacons with the plugins default settings sure to the use of the neverForLocation flag: https://developer.android.com/guide/topics/connectivity/bluetooth/permissions#assert-never-for-location

When targeting android 12+, you'll need to use the slim variant of the plugin (instructions) and remove the android:usesPermissionFlags="neverForLocation" bit from the example manifest. Then you'll need to request ACCESS_FINE_LOCATION on Android 12 at runtime. I usually use the cordova.plugin.diagnostics for this.

Unfortunately, there's no way for me to wrap the above up in the plugin, but I might put together some better documentation about how to do this with an example.

valeprog commented 11 months ago

Hi @peitschie Ok thanks I'll try.

valeprog commented 11 months ago

ok without android:usesPermissionFlags="neverForLocation" it work fine.

peitschie commented 11 months ago

Fantastic. Glad you were able to sort things out @valeprog