-
Notifications
You must be signed in to change notification settings - Fork 589
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 claims client state is RxBleClient.State.READY even when location service is off (Android 10 location changes) #742
Comments
Is the app in your case able to scan? Or Is there some kind of an error emitted? I see no logs. |
@sandy-8925 Ping? |
It's not able to scan i.e no devices show up. Only after location services is turned on, and the app is restarted, is it able to scan and pick up devices. I don't think any error was emitted, but I'll try reproducing it and see if there's anything relevant in the logs (like stacktrace or system error/warning). |
I have just pushed a branch You can use JitPack for testing purposes. |
@sandy-8925 Ping? |
I tested, and unfortunately, the problem still remains. The problem is in this function - Since the target SDK of the app is API 22, this function returns false, thus resulting in the library thinking that location service is not required at all. The function you changed |
Correct me if I am wrong but you should not be able to upload such an application to Play Store now? |
That limitation applies to the Play Store only, it doesn't apply to sideloaded Android apps. They library isn't limited to only being used in Play Store apps. This app I used it in, is an open source app that I forked. It's distributed through FDroid. The problem occurs on Android 10 and above, which seems to enforce location permission requirement for Bluetooth scanning, regardless of target level. |
Do you know if the same does apply to android wear? |
I am not aware of the behaviour on WearOS , but it should be the same. |
Check the latest commit on that branch |
I tested with that latest change, and can confirm that it works correctly now. BTW, it seems it's missing a dependency on RxRelay, the app keeps crashing because of the missing dependency. I was able to fix it by adding |
Jitpack does not seem to generate a proper POM file and other dependencies are not correctly fetched. This should go away with a proper release |
Ok, it looks like problem solved then. Thanks! |
Fix available in |
Describe the bug
This is for applications targeting API 22. When the location service is off, RxBleClient.observeStateChanges() returns RxBleClient.State.READY even though Android location services is off. This is due to the check in LocationServicesStatusApi23.isLocationProviderEnabledRequired() that assumes that location services is not required for apps targeting API 22 - on Android 10 (API 29), this is not the case. Location services is required regardless of which Android version the app targets.
To Reproduce
Steps to reproduce the behavior:
Specific application where the above situation occurs - https://github.com/sandy-8925/BLExplorer/blob/modernization_v2/android/src/main/java/org/ligi/blexplorer/BluetoothController.kt#L56
Expected behavior
RxBleClient.State.LOCATION_SERVICES_NOT_ENABLED should be emitted by RxBleClient.observeStateChanges() in this case
Smartphone (please complete the following information):
Logs from the application when bug occurs (this will greatly help in quick understanding the problem)
To turn on logs use:
The text was updated successfully, but these errors were encountered: