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.
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:
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.