flutter-geolocator
flutter-geolocator copied to clipboard
Enquiring location service is used on Android
💬 Questions and Help
As the geolocator's document mentions, LocationManager will be used when the FusedLocationProviderClient is not available on Android. I have multiple android phones with different models and trying to use the flutter-geolocator package to collect accurate GPS reading. Some models can provide relatively acceptable readings, but some models have returned inaccurate results (some readings fly over more than 1km).
Could the inaccurate readings be provided by the LocationManager instead of FusedLocationProviderClient?Can we enquire which service is applied during the runtime of the app?
Update:
I am using geolocator: ^6.2.1 for my application.
At the moment of writing this comment, on default FusedLocationProviderClient is used if the Google Play Services are available on the used device, otherwise the LocationManager is used. See the code snippet below [https://github.com/Baseflow/flutter-geolocator/blob/master/geolocator/android/src/main/java/com/baseflow/geolocator/location/GeolocationManager.java#L88]:
return isGooglePlayServicesAvailable(context)
? new FusedLocationClient(context, locationOptions)
: new LocationManagerClient(context, locationOptions);
There is a way to force Androids LocationManager by passing the forceAndroidLocationManager=true param when initializing a positionStream.
Oh, Thank You! Would it better to have a indictor in package level to indicate which service is in using, for example, isUsingFusedLocationClient?