BirjuVachhani / locus-android

An Awesome Kotlin Location library to retrieve location merely in 3 lines of code
https://birju.dev/posts/retrieve-location-in-just-3-lines-android/
Apache License 2.0
358 stars 40 forks source link

Support for Coarse/Approximate Location Only #93

Open Sypers opened 9 months ago

Sypers commented 9 months ago

Describe the bug I have an app that can work with coarse/approximate location. when the user chooses to use approximate location from the permission request dialog the Locus location request seem to detect that the permission has not been granted. I think its because Locus uses fine/percise location only.

To Reproduce Steps to reproduce the behavior:

  1. Request location and allow approximate location only
  2. Invoke Locus for a location request
  3. LocusRequest produces an error of permission denied and no location data is provided.

Expected behavior Proceed to provide the location according to the restrictions of approximate location use.

Smartphone (please complete the following information):

BirjuVachhani commented 9 months ago

Hi @Sypers, Locus does support all the configuration you can do with LocationRequest:

Locus.configure {
    request {
        // Set priority, interval, maxTime, etc.
    }
}

Does this answer your query? If not, then let me know how you would it manually.

Sypers commented 9 months ago

The problem is if the user only grants the permission for approximate location the location throws a permission not granted while the expected behavior should be that the location request retrieves the location info even if it's inaccurate. I took a quick look at the source code and it seems that the precise location permission is required for the request to be successful. I would suggest a variable for the Locus configuration that does not force precise location permission to be granted and suffice with approximate location.