-
Notifications
You must be signed in to change notification settings - Fork 318
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add MapboxNavigationOptions to adjust location validation thresholds #818
Conversation
@@ -81,7 +81,8 @@ private boolean isAccuracyAcceptable(@NonNull Location location) { | |||
boolean improvedAccuracy = currentAccuracy <= previousAccuracy; | |||
boolean currentAccuracyWorse = currentAccuracy > previousAccuracy; | |||
boolean hasSameProvider = lastValidLocation.getProvider().equals(location.getProvider()); | |||
boolean lessThanPercentThreshold = (accuracyDifference <= (previousAccuracy / locationPercentAccuracyThreshold)); | |||
double percentThreshold = locationPercentAccuracyThreshold / 100; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
percentThreshold will end up being either 0 or 1 here...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@kozyr thanks!
50dd2a9
to
a17fd52
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think remarking the units of the thresholds is important to users, we should fix the variables names and the method names in MapboxNavigationOptions
builder to reflect those and avoid confusion to developers using LocationValidator
. What do you think?
9e4a49e
to
45fd1d8
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good job @danesfeder
We introduced
LocationValidator
to filter incoming GPS updates. This currently has static constants as thresholds. This PR enables developers to adjust these as needed for their given requirements.