0

Fused Location Api when the google api client get Connected //

public void onconnected()
{
    LocationServices.FusedLocationApi
                    .requestLocationUpdates(mGoogleApiClient, mLocationRequest, this);
} 

but suppose due to no network ,no wifi and no gps the client keeps on checking for location.

so is there any method by which i could terminate it...if onlocationchanged doesnot get called in 1 minute or such interval ?

Andrey Korneyev
  • 26,353
  • 15
  • 70
  • 71
Rumour
  • 310
  • 3
  • 20

1 Answers1

0

No, you have to implement your own way to wait up to 1 minute and terminate waiting for location. You also need to act properly with lifecycle and situation when user will get location update earlier.

3mpty
  • 1,354
  • 8
  • 16
  • But How to do that.i am basically implementing this in a service...which terminates itself when it gets location..or else the service also keeps running. – Rumour Jun 08 '15 at 08:06
  • There're few ways to do it, imho simplest one is to add CountDownTimer that will terminate your service in onFinish() callback method – 3mpty Jun 08 '15 at 08:44