setFastestInterval(long milis) not working
Asked Answered
J

1

1

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.

Jailbird answered 20/9, 2013 at 10:17 Comment(0)
J
2

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 .

Jailbird answered 20/9, 2013 at 15:31 Comment(2)
LocationClient is deprecated. Look at this answer for current options: LocationManager or Location Service APIUltracentrifuge
thanks for commenting. Was it deprecated one year ago ? Right now I am using LocationManager. note, you have to considered that the new FusionLocation api are part of Google services which might not be available for some projects.Jailbird

© 2022 - 2024 — McMap. All rights reserved.