Skip to content

Conversation

@Andyporras
Copy link
Member

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)

  • N/A

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

    • Added a "latch" mechanism (isAccuracySatisfied).
    • The service now ignores incoming location updates until one arrives with an accuracy better than or equal to the configured value.
    • Once the accuracy is met, recording starts normally for all subsequent points.
  • 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)

image

✅ Pull Request Checklist

  • The PR is proposed to the DEVELOP branch.
  • The changes have been tested on the target Android API and minimum Android API.
  • Automated tests have been added (if applicable).
  • The feature is well documented.
  • There is a reference to the original ISSUE and related work.

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

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.
Copy link
Member

@jamescr jamescr left a comment

Choose a reason for hiding this comment

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

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.
@Andyporras
Copy link
Member Author

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!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants