DarkLeafyGreen
DarkLeafyGreen

Reputation: 70406

Location Updates available but disabled

I experience a strange problem. I just implemented a location client to retrieve users position like in the doc: Retrieving the Current Location

To test the error dialog if no connection is available I enabled flight mode and disabled location services.

int resultCode =
          GooglePlayServicesUtil.isGooglePlayServicesAvailable(getActivity());

However this code returns a ConnectionResult.SUCCESS. When I try to get the location I get null but shouldn't the resultCode return some error (as they say in the doc)? Any ideas where the problem is? My code is mostly the same as in the doc example.

Upvotes: 1

Views: 47

Answers (1)

kevskree
kevskree

Reputation: 4592

I may be wrong on this but I believe since Google Play Services is not just for location services (ie. you can still do Activity Recognition without access to the users location) it should still return ConnectionResult.SUCCESS. According to the documentation, the isGooglePlayServicesAvailable basically checks if Play Services is installed and on the correct version required for your app.

In order to check for availability of user location you still have to check the isProviderEnabled on the LocationManager class.

Upvotes: 1

Related Questions