michalchudziak/react-native-geolocation

`auto` always yields the Android location provider, not Play Services

jkaufman opened this issue · 2 comments

Reviewing the code, it appears that the default location provider configuration setting, auto, always yields the Android location provider.

  • At GeolocationModule.java:37, mLocationManager is set to AndroidLocationManager.
  • When the configuration is set, onConfigurationChange checks for the values android and playServices, but auto is a no-op. As a consequence, the location manager remains android by default.

On line 54:

else if (Objects.equals(config.locationProvider, "playServices") && mLocationManager instanceof AndroidLocationManager)

… should probably read …

else if ((Objects.equals(config.locationProvider, "playServices") || Objects.equals(config.locationProvider, "auto")) && mLocationManager instanceof AndroidLocationManager)

Hey, that's correct. I indeed wanted to keep the android.location backend default for 3.X release, to get the feedback from the community and resolve issues. I will change this behaviour in upcoming versions when it becomes stable enough.