mirror of
https://codeberg.org/comaps/comaps
synced 2026-01-09 22:04:43 +00:00
[android] remove previous location quality check
This commit is contained in:
committed by
Konstantin Pastbin
parent
0ff6cb26e4
commit
a519ecf00d
@@ -208,17 +208,8 @@ public class LocationHelper implements BaseLocationProvider.Listener
|
||||
return;
|
||||
}
|
||||
|
||||
// if (mSavedLocation != null)
|
||||
// {
|
||||
// if (!LocationUtils.isLocationBetterThanLast(location, mSavedLocation))
|
||||
// {
|
||||
// Logger.d(TAG, "The new " + location + " is worse than the last " + mSavedLocation);
|
||||
// return;
|
||||
// }
|
||||
// }
|
||||
|
||||
updateProviderDecision(location);
|
||||
if(mCurrentProvider == null || !mCurrentProvider.equals(location.getProvider())) {
|
||||
if(mCurrentProvider != null && !mCurrentProvider.equals(location.getProvider())) {
|
||||
Logger.d(TAG, "Rejected update from provider = " + location.getProvider());
|
||||
return;
|
||||
}
|
||||
@@ -249,7 +240,7 @@ public class LocationHelper implements BaseLocationProvider.Listener
|
||||
|
||||
if(timeDiff > INTERVAL_PROVIDER_DECISION) {
|
||||
mCurrentProvider = getMinAccuracyProvider();
|
||||
Logger.d("ProviderDecision", "Selected: " + mCurrentProvider + ", with acc. " + mProviderAccuracyMeans.get(mCurrentProvider));
|
||||
Logger.d(TAG, "Selected: " + mCurrentProvider + ", with acc. " + mProviderAccuracyMeans.get(mCurrentProvider));
|
||||
mTimeAtLastProviderChange = currentTime;
|
||||
mProviderLocationCounts.clear();
|
||||
mProviderAccuracyMeans.clear();
|
||||
|
||||
@@ -81,20 +81,6 @@ public class LocationUtils
|
||||
return location.getAccuracy() > 0.0f;
|
||||
}
|
||||
|
||||
public static boolean isLocationBetterThanLast(@NonNull Location newLocation, @NonNull Location lastLocation)
|
||||
{
|
||||
if (newLocation.getElapsedRealtimeNanos() < lastLocation.getElapsedRealtimeNanos())
|
||||
return false;
|
||||
|
||||
// As described in isAccuracySatisfied, GPS may have zero accuracy "for some reasons".
|
||||
if (isFromGpsProvider(lastLocation) && lastLocation.getAccuracy() == 0.0f)
|
||||
return true;
|
||||
|
||||
double speed = Math.max(DEFAULT_SPEED_MPS, (newLocation.getSpeed() + lastLocation.getSpeed()) / 2.0);
|
||||
double lastAccuracy = lastLocation.getAccuracy() + speed * LocationUtils.getTimeDiff(lastLocation, newLocation);
|
||||
return newLocation.getAccuracy() < lastAccuracy;
|
||||
}
|
||||
|
||||
public static boolean areLocationServicesTurnedOn(@NonNull Context context)
|
||||
{
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.P)
|
||||
|
||||
Reference in New Issue
Block a user