evothings / cordova-ble

Bluetooth Low Energy plugin for Cordova
http://www.evothings.com/
Apache License 2.0
242 stars 103 forks source link

Not working on Android 10+ (permission issue?) #162

Open phatpaul opened 3 years ago

phatpaul commented 3 years ago

I know this project is not active, so this probably won't be fixed. But it's worth pointing out that this plugin is not working for me anymore when compiled for Android SDK 29. There are no runtime errors in console, and no BLE devices are discovered.

A quick search brings up new permission requirements for Android 10+:

android.permission.ACCESS_FINE_LOCATION,
android.permission.ACCESS_COARSE_LOCATION,
android.permission.ACCESS_BACKGROUND_LOCATION.

https://stackoverflow.com/questions/58428763/android-10-not-working-with-ble-bluetooth-scanning

I tried adding those to the AndroidManifest.xml with no luck.

It's interesting that older versions of my App which were compiled previously with older SDK continues to work and discover BLE devices on Android 10+. And seems google won't let me submit a newly build app to the app store unless SDK >= 29.

WTF does google require FINE and BACKGROUND location just to use BLE? I'm not trying to spy on users of my app and I don't use location at all. IMO by requiring these in every BLE app, they are desensitizing people to the requirement of location permission. So when a spyware app asks for LOCATION permission it just seems normal. Anyway... Rant over.

Has anyone got this working on Android 10+?

jb-72 commented 3 years ago

Yes, @phatpaul it does work on Android 10+. Had the same issue months ago.

It seems it's fine for new installers of the app but is an issue is for users updating (which I assume you are too). The only solution we have found is for users to turn off their location permissions and then turn them straight back on again which seems to make Android set the correct settings internally. Changing the android.permissions made no difference, seems it is a bug between Android SDK versions.