Skip to content

BradPatras/gpx-recorder

Repository files navigation

gpx-recorder 🛰 🗺

Android app to record gps routes in the background and allow user to export routes to GPX or GeoJSON files

Google Play Store link

   

Libs and stuff

Arch Notes

Background Recording

To record location in the background, the app uses a foreground service class, LocationRecorderService. The nice thing about using foreground services is that it's much less likely to be killed by over-zealous system optimization initiatives. The main requirement of a foreground service is that you must display a notification as long as it's running. This requirement works perfectly for this app because it allows us to provide the user with route recording actions such as pausing/stopping/adding a waypoint without needing to open the app.

Internally the LocationRecorderService utilizes the FusedLocationProvider library from google. The interface is pretty simple, you feed it a configuration, start the location request, and then handle the location updates as they roll in.

The foreground service is controlled in two ways:

Android Intents

When a user taps on a button on the foreground service notification, the service receives an intent. It checks the intent's extras for keys and performs the corresponding action.

Service Binding

The app can't directly access the running service like a normal static instance or class, a connection must be made using a Service Binding. Once a connection is established, functions of the service can be accessed through the connection.

EventBus is also used to allow the service to notify the app when important things happen that may require UI to be updated.

Route Storage

The routes are all stored locally with a Realm database. The format of realm object storage makes it really straightforward to store the nested data that makes up a route. Routes have Waypoints and Tracks which are made up of Segments which are made up of TrackPoints. The app is entirely offline focused so the realm database is the source of truth and all updates to the UI related to routes happen as a result of the database being updated.

A Route is converted to the gpx or geojson file format on-demand and the app only knows how to do Route -> .gpx/geojson conversions. Converting files back into Route objects is not currently a feature.

Releases

Releases are now documented using this repo's Releases page.

Older releases

- 2.11 | Dec 5, 2023

- 2.10 | Sep 25, 2023

  • Migrated from deprecated startActivityForResult

- 2.9 | Aug 16, 2023

  • Czech translations added (thanks to @pocitas for contributing!)
  • French, Spanish, German translations added (auto-generated)

- 2.8 | Jun 13, 2023

  • Fixed crashes around navigation
  • UI tweaks
    • Sped up animations
    • Updated verbiage in resume workflow

- 2.7 | Jun 10, 2023

  • Updated foreground service code to adhere to new Android requirements
  • Fixed some styling issues

- 2.6 | Sep 12, 2022

  • Fixed a crash related to realm library update
  • Add waypoint to stopped route feature

- 2.5 | Sep 4, 2022

  • Resume route feature
  • GeoJSON export format support
  • UI component updates
  • Dark mode support (color system rework)

- 2.4 | Feb 20, 2022

  • Updated dependency versions
  • Added licenses info
  • Migrated from Kotlin synthetics to view binding

- 2.3 | Aug 13, 2021

  • Fixed time zone issue - timestamps are always in UTC now
  • Reduced waypoint location max wait time to 5 seconds

- 2.2 | Oct 10, 2020

  • Updated target to Android 11
  • Added "Save to device" option when exporting route.
  • Updated background location permission request flow for Android 10 and 11

- 2.1 | Dec 22, 2019

  • Moved recording controls to a list cell
  • Added recorder page to allow viewing route while recording

- 2.0 | July 5, 2019

  • Removed route previews from list
  • Removed Glide library from project
  • Added warnings for route deletion
  • Added map type toggle
  • Implemented bottom app bar and bottom menu sheet
  • Added currently recording route controls to main app screen

- 1.8 | March 19, 2019

  • Switched all route preview loading and caching to Glide using DataFetcher and ModelLoader subclasses
  • Added link to legal

- 1.7 | February 23, 2019

  • Swapped interval selector to Number Pickers
  • Persist last selected interval as default
  • Fixed memory leaks

- 1.6 | November 3, 2018

  • Added App Shortcut for starting a new recording
  • Use localized date and time formats
  • Added export button to details page
  • Added warning to rooted users that the app may not function properly

- 1.5 | October 21, 2018

  • Reduced app size by 65%
  • Fixed more issues with Android 9

- 1.4 | October 16, 2018

  • Revert app bundle and apk size changes due to build crashes
  • Fix Android 9 issues

- 1.4 | October 15, 2018

  • Updates for Android Pie
  • Fix for rooted devices

- 1.3 | October 14, 2018

  • Fix for crash on detail page on specific devices
  • Reduced app install size by about 65%

- 1.2 | September 8, 2018

  • Fixed an issue where the app was taking a large amount of disk space
  • Misc. improvements and optimizations

- 1.1 | August 16, 2018

  • Rewrote the route list to be more reliable.
  • Added additional error handling for devices that cannot initialize the local database.
  • Fixed crashes

- 1.0 | July 5, 2018

  • Initial release!

About

Android app to record routes in background and export to gpx/geoJSON files

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages