Skip to content
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

Merged
merged 4 commits into from
Apr 3, 2018

Conversation

danesfeder
Copy link
Contributor

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.

@@ -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;
Copy link

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...

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@kozyr thanks!

@danesfeder danesfeder force-pushed the dan-adjust-validation-thresholds branch from 50dd2a9 to a17fd52 Compare April 3, 2018 16:30
Copy link
Contributor

@Guardiola31337 Guardiola31337 left a 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?

@danesfeder danesfeder force-pushed the dan-adjust-validation-thresholds branch from 9e4a49e to 45fd1d8 Compare April 3, 2018 18:33
Copy link
Contributor

@Guardiola31337 Guardiola31337 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ship_it

Good job @danesfeder

@danesfeder danesfeder merged commit 4daaed8 into master Apr 3, 2018
@danesfeder danesfeder deleted the dan-adjust-validation-thresholds branch April 3, 2018 18:44
@danesfeder danesfeder mentioned this pull request Apr 3, 2018
13 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants