10

I set my application to get location notification every 5 seconds.

    mLocationRequest = LocationRequest.create();
    mLocationRequest.setPriority(LocationRequest.PRIORITY_HIGH_ACCURACY);
    mLocationRequest.setInterval(5000);
    mLocationRequest.setFastestInterval(5000/6);
    myLocationReq.requestLocationUpdates(mLocationRequest

so - every 5 seconds, onLocationChanged is being called. This is working fine.

Now I want to change the interval to be 1 second, without calling

     requestLocationUpdates

How can this be done?

DuduArbel
  • 1,100
  • 1
  • 12
  • 25

1 Answers1

1

Hope this answer isn't too late, but simply create a LocationRequest object, with the desired setInterval value. And then just call requestLocationUpdates with it.

I used this with tabs where 1 tab had to get location updates faster than the others. So I just changed the interval in the onResume and onPause methods.

Fanta1090
  • 41
  • 8