barbeau / gpstest

The #1 open-source Android GNSS/GPS test program
Apache License 2.0
1.75k stars 361 forks source link

Wear OS - Add logging and log file sharing #611

Open barbeau opened 1 year ago

barbeau commented 1 year ago

Is your feature request related to a problem? Please describe. One of the main features of GPSTest is logging data to files and sharing those files (e.g., via email). We currently don't have the ability to log data on Wear OS.

Describe the solution you'd like We'd like to be able to log data on Wear OS and share captured files.

Here's a UI mockup:

image

There are two steps to implementing this:

  1. Log the files - You'll first need to set all the logging preferences to true by default. In the mobile app, this is done in the Settings screen using preferences.xml (the defaults there for file logging are all false). For our purposes, we can just programmatically set all these to true on Wear OS app startup using the PreferenceUtil.kt class. You'll just need to create setter methods for these preferences similar to all the existing getter methods that are named writeXToFile() and return a Boolean value. Then, when the user taps on the "Start Log" button, you can start the ForegroundOnlyLocationService (this can be moved to the library too). You can see how this service is bound and started in the MainActivity of the mobile app. After you call ForegroudnOnlyLocationService.subscribeToLocationUpdates() to start the service, it should automatically start logging everything to files if you've set all the file logging preferences to true. When the user taps on "Stop Log", you can call ForegroudnOnlyLocationService.unsubscribeToLocationUpdates() to stop the service and stop logging. At that point you can start the code to share the file.

  2. Share the files after logging stops - I haven't done a deep investigation into this, but I'm not sure if you can just do a send intent from a Wear OS app like you can in the mobile app. We'll need to do some more investigation to determine if we can send a file without transferring it to a mobile app first. This section on "Handling data" and several of it's sub-pages seem like a good place to start. Our first preference should be sending this stand-alone from the Wear OS, but if that's not possible we will need to determine the best way to transfer the files to the phone (using the GPSTest mobile app?) and then sharing from the phone.

@adaext Could you work on this?

barbeau commented 1 year ago

Let's also split the work on this into two PRs to make it more manageable - one PR for the logging, and one PR for the file sharing.

stale[bot] commented 1 year ago

This issue has been automatically marked as stale because it has not had recent activity. Please comment here if it is still valid so that we can reprioritize. Thank you!

barbeau commented 1 year ago

Not stale

stale[bot] commented 5 months ago

This issue has been automatically marked as stale because it has not had recent activity. Please comment here if it is still valid so that we can reprioritize. Thank you!

barbeau commented 5 months ago

Not stale