Google Play Services for Android. Location client not update location if wifi disabled-ThrowExceptions

Exception or error:

Our app request update location with LocationClient and IntentService.
Location doesn’t update at all if user disable wifi in phone settings.

We tried to test app with PRIORITY_HIGH_ACCURACY and location updates when wifi disabled.

The same issue if user moving in the place where no wifi networks available.

I think correct behavior is use other phone sensors (like GPS) for update location if phone can not update location with wifi.

Steps to reproduce:

  1. Start update location with pending intent. With parameters

    LocationRequest request = LocationRequest.create()
            .setInterval(5 * 60 * 1000)
  2. Disable wifi in phone settings or go with phone in the country where no wifi networks available.

Tested on Android 4.4, 4.3, 4.1, 4.0, 2.3.3. (Nexus7, Nexus4, Samsung GS2, HTC Wildfire and others)

public class TrackerService extends IntentService {
    private void startUpdateLocation() {
        PendingIntent pendingIntent = PendingIntent.getService(getApplicationContext(),
            0, new Intent(ACTION_LOCATION_UPDATED), 0);
        LocationRequest request = LocationRequest.create()
            .setInterval(5 * 60 * 1000)

        getLocationClient().requestLocationUpdates(request, pendingIntent);
        Log.d(Utils.getMethodName(), "Location update started");

    private LocationClient getLocationClient() {
        if (mLocationClient != null && mLocationClient.isConnected()) return mLocationClient;
        mLocationClient = new LocationClient(this,
            new GooglePlayServicesClient.ConnectionCallbacks() {
                public void onConnected(Bundle bundle) {
                    Log.d(Utils.getMethodName(), "Location client. Connected");

                public void onDisconnected() {
                    Log.d(Utils.getMethodName(), "Location client. Disconnected");
            new GooglePlayServicesClient.OnConnectionFailedListener() {
                public void onConnectionFailed(ConnectionResult connectionResult) {
                    throw new IllegalStateException("Failed connection to location manager " + connectionResult.toString());
        try {
            while (mLocationClient.isConnecting()) {
        } catch (InterruptedException e) {
            throw new IllegalStateException("Thread interrupted", e);
        return mLocationClient;

I tried to send bug report

Developers of Android can’t help.

Where can I report about bugs in Google Play Services?

Is it a bug in Google Play Services?

What work around could you offer?

We don’t want use PRIORITY_HIGH_ACCURACY because it drain phone battery. Our application tracking phone location and it shouldn’t depends from wifi settings and wifi networks availability.

How to solve:

I found solution.

Google changed documentation for Location Client. Now it says:


Used with setPriority(int) to request “block” level accuracy.

Block level accuracy is considered to be about 100 meter accuracy.
Using a coarse accuracy such as this often consumes less power.

Using a coarse accuracy – I think it means that Location Client doesn’t use GPS for update location if priority is PRIORITY_BALANCED_POWER_ACCURACY.

So for using GPS you should use PRIORITY_HIGH_ACCURACY.


Let me try to give you one answer to this. Up until a few minutes ago I was having the same problem and was hoping there would be an answer here.

I’ll describe my problem and solution:

I didn’t get any location updates without an internet connection while using Google Play services LocationClient. GPS enabled.

My code was stable and working with Internet available, but field tests failed.

Possible root causes:
1) LocationClient sucked
2) location client didn’t get any gps updates

To test this I tried using the google maps app. It complained without an internet connection, so I gave it one. Then I tried to locate myself, but a new screen popped up saying that I had to allow “google apps” to access my location. It said that this would not affect 3rd party apps not from google, which turned out to be complete bullshit. When I enabled “only google apps” to access my location my own app suddenly kicked into action within seconds. Developing for android has been full of these “Google moments”.


If someone is still wondering,

Google documentation says:

If you are using both NETWORK_PROVIDER and GPS_PROVIDER, then you need to request only the ACCESS_FINE_LOCATION permission, because it includes permission for both providers. Permission for ACCESS_COARSE_LOCATION allows access only to NETWORK_PROVIDER.

Leave a Reply

Your email address will not be published. Required fields are marked *