This repository has been archived by the owner on May 15, 2024. It is now read-only.
[Bug] Can't distinguish between Location turned OFF or if device doesn't have hardware to support it #2034
Labels
bug
Something isn't working
Hi all,
I'm facing a super odd scenario when trying to check if the user has the phone Location ON.
Context:
My app is communicating with a Bluetooth device using a BLE protocol.
For some Android versions (e.g. 9 or 10), in order to use the Bluetooth, we also need to ask for location permissions and have the location turned on in our device. Otherwise, if we perform a scan nothing is found and no exceptions are fired.
Workaround:
So far, one of the solutions trying to check if the location is ON and if not we can move the users to the settings section where they can turn it on manually.
To check the Location status we're using the following code (suggested in several forums/blogs and even in some issues reported here):
Problem:
This code works perfectly for most of the devices but, the ones without GPS antenna will always return 'false' when evaluating if the provider is enabled and even if the user has the value turned ON on device settings.
In one hand I understand why we are getting the 'false' value but, in the other hand, we really have the location turned ON and we could have a 'true' result due to that.
As a side note, if the location still needs to be turned ON on these devices without GPS antenna to scan BT devices properly.
Question:
Is there any workaround so we can check if the device has the hardware and the location settings option turned ON?
Because it seems that we need to distinguish these two situations.
Thanks.
-- Minimum version: Android 6.0 (API Level 23)
-- Target version: Android 12.0 (API Level 31)
The text was updated successfully, but these errors were encountered: