[android] prediction fix

This commit is contained in:
ExMix 2014-11-25 15:23:29 +03:00 committed by Alex Zolotarev
parent 27afe799dd
commit bd3ec5e576

View file

@ -99,19 +99,20 @@ public class LocationPredictor
if (mLastLocation == null || mGeneratePredictions == false)
return false;
if (mLastLocation.hasBearing() && mLastLocation.hasSpeed() && mPredictionCount < MAX_PREDICTION_COUNT)
if (mPredictionCount < MAX_PREDICTION_COUNT)
{
Location info = new Location(mLastLocation);
info.setTime(System.currentTimeMillis());
long elapsedMillis = info.getTime() - mLastLocation.getTime();
double[] newLatLon = Framework.predictLocation(info.getLatitude(), info.getLongitude(), info.getBearing(),
info.getSpeed(), info.getAccuracy(), elapsedMillis / 1000.0);
double[] newLatLon = Framework.predictLocation(info.getLatitude(), info.getLongitude(), info.getAccuracy(), info.getBearing(),
info.getSpeed(), elapsedMillis / 1000.0);
info.setLatitude(newLatLon[0]);
info.setLongitude(newLatLon[1]);
mListener.onLocationUpdated(info);
return true;
}
return false;