问题
I want to slow the update rates as soon as I got a location precise enough for my needs:
@Override
public void slowUpdateRate() {
/*
* Set the update interval
*/
Dbg.v(TAG,"****************************");
Dbg.e(TAG, "-- SLOW update rate");
Dbg.v(TAG,"****************************");
stopUpdates();
mLocationRequest.setInterval(1500000);
mLocationRequest.setFastestInterval(150000);
mLocationClient.requestLocationUpdates(mLocationRequest, this);
The method is called but I still got updates every 3 seconds and a half. I have a ViewPager with a maps 2.0 fragment but I did mapFragment.getMap().setMyLocationEnabled(false);
How do I slow updates? Why FastestInterval is not working?
EDIT: I test my slow updates on the dummy application provided by Google docs and it works ok. I added a LogCat getFastestInterval and getInterval and I got the 15 and 30 seconds I was expecting in the test context. BUT the update rate is still freaking too high.
回答1:
I got this !
The mistake is mine and can be resume in this
DO NOT CALL AGAIN mLocationClient.requestUpdates(mLocationRequest,this);
Also, remember that the default fastest interval is your normal interval/6 .
来源:https://stackoverflow.com/questions/18914316/setfastestintervallong-milis-not-working