You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In the LegacyLastLocationFinder.getLastBestLocation() method, the tests on the
fix time are inverted!
if ((time < minTime && accuracy < bestAccuracy))
should be:
if ((time > minTime && accuracy < bestAccuracy))
if (time > minTime && bestAccuracy == Float.MAX_VALUE && time < bestTime)
should be:
if (time < minTime && bestAccuracy == Float.MAX_VALUE && time > bestTime)
and
if (locationListener != null && (bestTime > minTime || bestAccuracy >
minDistance))
should be:
if (locationListener != null && (bestTime < minTime || bestAccuracy >
minDistance))
It is less important but the comment for the minTime is misleading.
I also think the test to get the latest fix no matter its accuracy in both
LegacyLastLocationFinder and GingerbreadLastLocationFinder should not include a
check on minTime. Then,
if (time < minTime && bestAccuracy == Float.MAX_VALUE && time > bestTime)
should actually be:
if (bestAccuracy == Float.MAX_VALUE && time > bestTime)
Original issue reported on code.google.com by [email protected] on 16 Aug 2011 at 5:17
The text was updated successfully, but these errors were encountered:
Worse yet. minTime is defined as "Minimum time required between location
updates" but it is being compared with Location.getTime() which is defined as
"Returns the UTC time of this fix, in milliseconds since January 1, 1970".
We shouldn't be comparing minTime with Location.getTime(). We should be
comparing it with timeElapsed (System.currentTimeMillis() - Location.getTime()).
This bug applies to GingerbreadLastLocationFinder as well.
Actually, the correct and simple fix would be to just edit the line
long time = location.getTime();
to
long time = System.currentTimeMillis() - location.getTime();
That will solve all issues.
Also minTime should be defined something like "Minimum time since last location
update"
Original issue reported on code.google.com by
[email protected]
on 16 Aug 2011 at 5:17The text was updated successfully, but these errors were encountered: