Add minimum GPS accuracy preference for logging #670
Add minimum GPS accuracy preference for logging #670Andyporras wants to merge 4 commits intolabexp:developfrom
Conversation
Introduces a new user preference to set the minimum required GPS accuracy (in meters) before starting to record track points. Updates the GPSLogger service to respect this setting, waiting until the specified accuracy is achieved before logging locations. Adds relevant strings and preference UI elements.
jamescr
left a comment
There was a problem hiding this comment.
Move preference keys and default values to OSMTracker. Preferences class. Check this commit for an example.
Min accuracy preference is numeric; consider using the setupEditTextNum() method from Preference Activity to force numeric inputs and add an option to reset to default value.
Introduced a new GPS minimum accuracy preference key and default value in OSMTracker. Updated Preferences activity to allow user configuration of minimum GPS accuracy. Refactored GPSLogger to use the new preference key and default, and removed the old constant from OpenStreetMapConstants.
|
Thanks @jamescr for the review. I've just refactored the code to move the constants to OSMTracker.Preferences and implemented setupEditTextNum() for the input field validation. Ready for another look! |
|
Andy, I reviewed the PR again, this time with more detail. You can see my suggestions in this branch. In general, the code was reordered, and some variables were renamed to keep consistency with the style of the files and project. I add a new string in strings-preferences.xml to avoid reusing a string with another purpose. Using 0 as the default value for the GPS logging accuracy is a bad practice because it could be interpreted by a user as the highest precision (0 m precision). One possible way to manage this could be with 2 preferences, one that enabled the GPS logging accuracy value and another that set the value (like the case of the background map prefs). But, we still have to consider a default value for the pref. A low value (let's say 2m) could take longer to be acquired, and the user could have the perception the app stops working. So a UI indicator will be needed to avoid the wrong perception. My point of view is that it probably would be better to have accuracy ranges and not a value. I mean, with this, something like High Precision (1m-10m), Standard (10m-30m) and Low Precision (30m+). And the default could be Standard. I open a PR to your repo just in case. The code in the branch is rebased. In Preferences.java I change a typo and delete an unused lib that was not part of your code. |
* Feature: Show note count in tracks list * Feature: Add a What's New slide to the App intro. * [Transifex] Updates for project OSMTracker for Android™ * [Transifex] Updates for project OSMTracker for Android™ (labexp#679) * Translate strings.xml in el 82% of minimum 80% translated source file: 'strings.xml' on 'el'. Sync of partially translated files: untranslated content is included with an empty translation or source language content depending on file format * Translate strings.xml in sk 82% of minimum 80% translated source file: 'strings.xml' on 'sk'. Sync of partially translated files: untranslated content is included with an empty translation or source language content depending on file format * Translate strings.xml in pl 91% of minimum 80% translated source file: 'strings.xml' on 'pl'. Sync of partially translated files: untranslated content is included with an empty translation or source language content depending on file format * Translate strings.xml in es 99% of minimum 80% translated source file: 'strings.xml' on 'es'. Sync of partially translated files: untranslated content is included with an empty translation or source language content depending on file format * Translate strings.xml in zh_TW 99% of minimum 80% translated source file: 'strings.xml' on 'zh_TW'. Sync of partially translated files: untranslated content is included with an empty translation or source language content depending on file format * Translate strings.xml in pt_BR 99% of minimum 80% translated source file: 'strings.xml' on 'pt_BR'. Sync of partially translated files: untranslated content is included with an empty translation or source language content depending on file format * Translate strings.xml in sv 93% of minimum 80% translated source file: 'strings.xml' on 'sv'. Sync of partially translated files: untranslated content is included with an empty translation or source language content depending on file format * Translate strings.xml in nl 93% of minimum 80% translated source file: 'strings.xml' on 'nl'. Sync of partially translated files: untranslated content is included with an empty translation or source language content depending on file format * Translate strings.xml in ru 93% of minimum 80% translated source file: 'strings.xml' on 'ru'. Sync of partially translated files: untranslated content is included with an empty translation or source language content depending on file format * Translate strings.xml in es 100% translated source file: 'strings.xml' on 'es'. * Translate strings.xml in pt_BR 100% translated source file: 'strings.xml' on 'pt_BR'. * Translate strings.xml in zh_TW 100% translated source file: 'strings.xml' on 'zh_TW'. --------- Co-authored-by: transifex-integration[bot] <43880903+transifex-integration[bot]@users.noreply.github.com> * Increases version number to 72 * Fix: Add fallback when pref value is not set * Translate strings-preferences.xml in es 100% translated source file: 'strings-preferences.xml' on 'es'. * Translate strings-preferences.xml in pt_BR 100% translated source file: 'strings-preferences.xml' on 'pt_BR'. * Translate strings-preferences.xml in zh_TW 98% of minimum 80% translated source file: 'strings-preferences.xml' on 'zh_TW'. Sync of partially translated files: untranslated content is included with an empty translation or source language content depending on file format * Increase version code to 73 * Increase version code to 74 * Translate strings-preferences.xml in zh_TW 100% translated source file: 'strings-preferences.xml' on 'zh_TW'. * Add minimum GPS accuracy preference for logging Introduces a new user preference to set the minimum required GPS accuracy (in meters) before starting to record track points. Updates the GPSLogger service to respect this setting, waiting until the specified accuracy is achieved before logging locations. Adds relevant strings and preference UI elements. # Conflicts: # app/src/main/res/values/strings-preferences.xml # app/src/main/res/xml/preferences.xml * Add GPS minimum accuracy preference and refactor usage Introduced a new GPS minimum accuracy preference key and default value in OSMTracker. Updated Preferences activity to allow user configuration of minimum GPS accuracy. Refactored GPSLogger to use the new preference key and default, and removed the old constant from OpenStreetMapConstants. * Refactor and review of PR670 --------- Co-authored-by: transifex-integration[bot] <43880903+transifex-integration[bot]@users.noreply.github.com> Co-authored-by: Andy Porras <andyporras6@gmail.com>
Introduces a new user preference to set the minimum required GPS accuracy before starting to record track points. Updates the GPSLogger service to wait until the specified accuracy is achieved, and adds relevant UI strings and preference entry.
📝 Feat: Settings: minimum GPS accuracy to start recording track
🛠️ Issue
🛠️ Related issues (if applicable)
📖 Description
This PR introduces a new user preference to set the minimum required GPS accuracy before starting to record track points.
Changes:
Preferences UI: Added a new EditTextPreference in the GPS Settings menu (prefs_gps_min_accuracy) allowing users to input a value in meters (e.g., 10). Default is 0 (disabled).
Logic Implementation: Updated GPSLogger.java to read this preference.
Strings: Added necessary string resources for the new setting.
Rationale: This prevents the recording of widely inaccurate points (jumping) that often occur immediately after starting the GPS, significantly improving the quality of the track's start, especially for vertical distance computation.
🖼️ Screenshots (if applicable)
✅ Pull Request Checklist
📝 Additional Notes
The logic ensures that we only wait once at the beginning. If the GPS accuracy degrades later (e.g., entering a tunnel), the recording continues uninterrupted to avoid gaps in the track, satisfying the requirement to "wait before starting".