FlutterBleLib icon indicating copy to clipboard operation
FlutterBleLib copied to clipboard

Is there a way to avoid the location permission check before starting a scan?

Open espositofulvio opened this issue 5 years ago • 4 comments

I know FlutterBleLib is based on RxAndroidBLE, I was wondering if in any way this option is suppted? I've read from this pull request https://github.com/Polidea/RxAndroidBle/pull/533 that is a supported use case for RxAndroidBLE, but does it bubble up to FlutterBleLib as well? I'mm writing an app where I could do without that check and my phone has no problem with other apps when location services are disabled.

espositofulvio avatar Feb 23 '20 11:02 espositofulvio

I'm not clear on what is it that you'd want. If I understand correctly, you'd like some kind of error telling you that though you started a scan, you won't get any results since you don't have a permission?

mikolak avatar Feb 24 '20 09:02 mikolak

Hi @mikolak. Nope, it's not that. I know Android requires ACCESS_FINE_LOCATION from 10 onwards and ACCESS_COARSE_LOCATION before that to perform a bluetooth scan and also requires location services to be enabled. There are quite a lot of phones that allow a bluetooth scan with location services switched off if the permission has been granted. RxAndroidBle defaults to check for permission and also for location services to be on, but an option has been added so that the second check be avoided (see the pull request I linked in my previous message). At the moment I'm getting an error when starting a scan with location services disabled but everything works if they're on. I couldn't find an option in FlutterBleLib to enable the other behaviour and was asking if I'm just missing it or it's not exposed. I hope my explanation is a bit clearer now.

espositofulvio avatar Feb 24 '20 09:02 espositofulvio

Ah, thanks for clarifying! I'll see what I can do.

mikolak avatar Feb 24 '20 09:02 mikolak

using this api would be able to find and connect to devices without needing location permission: companion-device-pairing document more detial in Youtube

@espositofulvio @mikolak

VinciShark avatar Aug 20 '20 14:08 VinciShark