webyonet / react-native-android-location-services-dialog-box

React Native Android Location Services Dialog Box
MIT License
182 stars 50 forks source link

Use the enableHighAccuracy parameter in the listener as well. #70

Closed SanderVerkuil closed 5 years ago

SanderVerkuil commented 5 years ago

The accuracy parameter wasn't reflected in the event, thus when checking if low accuracy is enabled and enabling the events, the status that was given only checked whether the GPS provider was enabled, resulting in a change where the status didn't change.

Extracted the function to check whether the location services are enabled based on the parameters given to the function.

Possible improvement might be to fire an event which returns something like:

{
  "enabled": hasGPS, // To be backwards compatible
  "lowAccuracy": hasGPS || hasNetwork,
  "highAccuracy": hasGPS && hasNetwork
}

I also found a bug that the listener only started when the location services were turned on. When silently checking for the location services, the listener wouldn't start. The listener is now also started when the services were not enabled.