Baseflow / Baseflow/flutter-geolocator
[Android] Nagging dialogue when "Google Location Accuracy" is turned off.
- Dominant language
- Dart
- Stars
- 1.3k
- Forks
- 803
- Avg merge
- 8h 16m
- Merged PRs (30d)
- 1
Description
## 🐛 Bug Report
On a phone with "Google Location Accuracy" turned off, invoking any method to request location updates causes a system dialog to be displayed on the screen, over the app.

"To continue, turn on device location, which uses Google's location service" with the options "No, thanks" and "OK".
Pressing "No, thanks" will dismiss the dialog and location updates will work as normal, but any future calls for location updates triggers the same dialog over and over again with no apparent way to permanently dismiss
It appears to be triggered by this line of code: https://github.com/Baseflow/flutter-geolocator/blob/e60daab16c5568ee46ff3c8851b16167c3e412e9/geolocator_android/android/src/main/java/com/baseflow/geolocator/location/FusedLocationClient.java#L227
Some debugging shows that despite location permissions being granted, and the GPS services turned on, the addOnFailureListener is called with a ResolvableApiException insisting that a related, but not required, service be enabled.
### Expected behavior
Users should not see this dialog at all, it's not related to the app's location permission, nor is it a requirement to receive location updates.
### Reproduction steps
Navigate into the device settings, find the "Location Services" options for the phone and disable "Google Location Accuracy", while leaving the actual "Location" service enabled.
Reuqest COARSE_LOCATION and FINE_LOCATION in your manifest, install the app and manually grant the location permissions through the app's settings page.
Make any request for locations, eg:
```Geolocator.getCurrentPosition(desiredAccuracy: LocationAccuracy.best)```
### Configuration
**Version:** 9.0.2
**Platform:**
- [ ] :robot: Android
Contributor guide
Research direction
Start at android/src/main/java/com/baseflow/geolocator/location/FusedLocationClient.java around line 227 and inspect how the addOnFailureListener handles the ResolvableApiException. Reproduce with Google Location Accuracy disabled while device Location remains enabled, then verify that repeated location requests no longer show the system dialog and still return location updates.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- android, java
- Domain
- mobile
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 58/100