I am trying to get notifications when the user enables/disables location services. I know that I can do this by using the android.location.LocationManager
API
https://developer.android.com/reference/android/location/LocationManager#MODE_CHANGED_ACTION
or
https://developer.android.com/reference/android/location/LocationManager#PROVIDERS_CHANGED_ACTION
But I cannot find an equivalent using the Google Play Services location API.
I can use checkLocationSettings
to see the current settings and display a dialog to resolve them if necessary. But without the option to register a receiver/listener, I have to write a polling loop for this call, which is a lot of wasted effort.
The package summary for android.location
https://developer.android.com/reference/android/location/package-summary says:
The Google Location Services API, part of Google Play services, is the preferred way to add location-awareness to your app. It offers a simpler API, higher accuracy, low-power geofencing, and more.
So surely there should be a simpler API to get programmatic notifications of location services enable/disable using Google Location Services than the default android.location.LocationManager
?
What am I missing here?