-
Notifications
You must be signed in to change notification settings - Fork 582
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
The library should require location services to be enabled to scan BLE devices only when absolutely needed #106
Comments
Hey, thanks for the report. Did you check https://code.google.com/p/android/issues/detail?id=189090? If that's true what you say, could you provide a pull request with this one changed, still with scanning working as expected? Thanks. |
I have read through the issue in the link you provided and it seems this doesn't affect all Android devices or Android versions. I think the library should not explicitly require the Location Services to be on for all Android versions and devices, because the majority of the devices will scan normally without Location Services being turned on. I have tested BLE scanning on dozens of devices and have never encountered one that requires Location Services to be on to enable scanning.
|
Hello @mfatiga |
@dariuszseweryn I have been building all of the apps with target SDK 23 or greater, and none of the apps I work on currently require location so the location services are turned off on all of my test devices. Daily test devices (the apps are tested on those devices on a daily basis): Me and my coworkers have also tested the apps on our personal devices and on many other devices from app users. |
I am building an app with SDK 25 and tested it with Location Services turned OFF:
|
…atibility mode (targetSdk < 23) Summary: Related: #106 Reviewers: michal.zielinski, pawel.urban Reviewed By: pawel.urban Differential Revision: https://phabricator.polidea.com/D2042
@mfatiga As it is not possible to currently distinguish at runtime which devices need Location Services to being turned on - I am closing. I could only add a check for the devices SDK and build SDK of the library - which I did. If the situation will change - feel free to reopen. Best Regards |
Thank you for all the effort! |
Hi, I just came across the same issue. Very few devices require location to be turned on for BLE callbacks and most of them are runs on Android Oreo. |
I think you should not require location services to be enabled. On Samsung devices with Android 6+ BLE scanning works properly without location. In my app I inform users that location services should be enabled if there is no scan results, but this info disappears when first scan result occurs. I do not want to force users to enable location services. |
I have added an option to |
Summary
Since Android 6.0 it is required to hold ACCESS_COARSE_LOCATION or ACCESS_FINE_LOCATION permissions to scan BLE devices but there is no requirement to enable Location Services.
The docs don't mention a requirement for Location Services to be turned on, only the requirement for ACCESS_COARSE_LOCATION or ACCESS_FINE_LOCATION permissions.
I have created a couple of BLE scanners without using any libraries, and have also been using Android Beacon Library (and have also contributed to it) for lots of projects in my company, and have never required Location Services to be enabled for scanning to work.
Actual result
The library throws an exception when calling scanBleDevices if the Location Services are not enabled.
Expected result
The library should only require ACCESS_COARSE_LOCATION or ACCESS_FINE_LOCATION permissions. The Location Services don't have to be turned on for the scanning to work properly.
The text was updated successfully, but these errors were encountered: