Baseflow / Baseflow/flutter-geolocator

forceLocationManager = true may still default to fused location

Open
#1,171 4 comments 0 reactions 1 assignee Claimed by @TimHoogstrate View on GitHub
Dominant language
Dart
Stars
1.3k
Forks
803
Avg merge
8h 16m
Merged PRs (30d)
1

Description

When setting `forceLocationManager: true` in `AndroidSettings`, geolocator may still request fused location provider.

The reason: `LocationManagerClient` calls [`LocationManager.getBestProvider()`](https://developer.android.com/reference/android/location/LocationManager#getBestProvider(android.location.Criteria,%20boolean)) in order to get an appropriate location provider. This method may return [`LocationManager.FUSED_PROVIDER`](https://developer.android.com/reference/android/location/LocationManager#FUSED_PROVIDER) on certain devices (in my case Samsung A13, Android 12).

There should be a way to force usage of [`LocationManager.GPS_PROVIDER`](https://developer.android.com/reference/android/location/LocationManager#GPS_PROVIDER) if network location is not desired. Suggestion: Don't call `LocationManager.getBestProvider()`, but always use `LocationManager.GPS_PROVIDER`, when `forceLocationManager` is set to `true`.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.