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?
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With