As we know we have two alternates for making our applicaiton location aware Either we use Google’s Location Services API (part of Google Play services) or we use Androids Location API .
The problem I have here is that using the Google's services , we have to use interface com.google.android.gms.location.LocationListener that provides us with location updates. However unlike the android.location.LocationListener, the google's version doesnt' provides us the state of the location provider (gps or internet).
we have the following methods in the Androids Location Listener
abstract void onLocationChanged(Location location)
Called when the location has changed.
abstract void onProviderDisabled(String provider)
Called when the provider is disabled by the user.
abstract void onProviderEnabled(String provider)
Called when the provider is enabled by the user.
abstract void onStatusChanged(String provider, int status, Bundle extras)
Called when the provider status changes
.
However in google we have just one
abstract void onLocationChanged(Location location)
How would I identify the changes in the provider if I am using the google services ? . For example in midst of the application usage , the user decides the shut off the GPS , I wanted to show a toast on this event.
I am in the dark how should I acheive that .