Kamil Lelonek
Kamil Lelonek

Reputation: 14744

Checking GPS status with Google Play Services

Google recommends now using Google Play Services to manage user location. But how can we, using this API, check wether GPS is turned on in device or if we still have gps connection?

In com.google.android.gms.location.LocationListener we have only one method abstract void onLocationChanged(Location location) which is called when the location has changed, but we don't know there anything about GPS status.

How to use Google Play Services like "old" LocationManager and LocationListener?

Upvotes: 8

Views: 5360

Answers (1)

CommonsWare
CommonsWare

Reputation: 1006724

But how can we, using this API, check wether GPS is turned on in device or if we still have gps connection?

You can't, AFAICT. I suppose the argument is that since LocationClient is blending data from several sources, there is no API to determine if any specific source is or is not being used.

You will need to use LocationManager if you want to determine whether GPS is enabled or not.

Upvotes: 10

Related Questions