2

I'd like to automatically start and stop recording a GPS track by sending an intent, e.g. from Tasker. I don't care what app is used to record the GPS track, and it's OK if I have to set it up myself beforehand, but it shouldn't require any user interaction when I send the intent. I just want to send the intent and have it start recording right away, and later (when my Tasker profile has detected that I've reached the end of the route) stop recording automatically and save the track so that I can review it later.

I also don't care whether the end result is a track that I can only access within the app that recorded it, or a GPX file that gets saved somewhere, or something that gets uploaded to a website automatically.

  • I hope you're not fixed to that intent – my suggested solution is a plain Tasker one :) Of course, if you are, you can use that intent to start the task... #D – Izzy Dec 18 '14 at 10:24
  • Guys, if you're going to VTC as "unclear", you really need to leave a comment saying what isn't clear. That's the only way I can improve the question for you. – Dan Hulme Dec 18 '14 at 12:48
  • Wasn't me, Dan. Your question seems very clear to me (or I wouldn't have answered it). So to close-voters: Explain yourselves! Maybe it's not your "area of expertise"? :) – Izzy Dec 18 '14 at 12:52
4

There's an open-source GPS track recording app called GPSLogger. It has shortcuts to start and stop, and also publishes the necessary intent details, so you can start and stop recording without having to interact with the phone. You can also configure it ahead of time (via the app's settings) to save files in various formats and/or upload to Dropbox, OpenStreetMap, or other sites of your choice.

I'm sure there are other apps with the same functionality.

2

As you already mention Tasker, that should be possible with this alone – though the profile might be a little tricky (complex) to build. To find the needed conditions/actions, I've just added some graphics to my Tasker Resources:

Tasker graph
Graph of available Tasker conditions and actions (as of 12/2014; click image for larger variant)

Actions to be used for this:

  • Location › Get Location
    (the fix data are stored in the relevant %LOC variables, see the Variables section of the userguide.)
  • File › Write File
    (If Append is checked, the text is added to the end of the file without changing the existing contents.)
  • Location › Stop Location
    (This is only necessary if the Keep Tracking parameter is checked in Get Location.) – but that's probably what you need to do

Basically, that outlines your task – just in the second bullet-point, you'll need to evaluate the %LOC variable in a loop. Pseudo-Code: "While (not-reached-target) do: (evaluate %LOC), (write file), (wait X seconds)". As the end-loop-condition is a, hm, condition, you'll probably need a slightly different approach:

  • before the loop, set a custom variable, e.g. %TRACKING_ACTIVE = 1
  • have a profile firing on that variable. Conditions:
    • %TRACKING_ACTIVE ~ 1
    • current location ~ target
  • that profile's task then: Variables › Variable Set (%TRACKING_ACTIVE = 0)
  • your "exit condition" for above while loop then is: %TRACKING_ACTIVE ~ 0

So much about a "raw outline" to get you started. Have not the time to try it out myself and ship the ready-to-use profile, sorry :) And of course you've got to figure the format of the file – but hey, you're a dev :) AFAIK GPX should be easy, KML as well, as both are text-based (XML) formats.

  • That's a convenient way to start it, but in general GPS recording apps have a lot of optimizations, e.g. setting the update rate dynamically according to your speed, and only recording positions to the GPX file when they're a certain distance apart. I think your hacked-up Tasker script would use more battery and produce a larger file - and as you say, it would need some custom programming to turn the file into something you could view or use with another app. – Dan Hulme Dec 18 '14 at 12:44
  • It would certainly need a lot of work to satisfy your wishes, Dan. I won't say it's perfect – but it's the only one I know. I didn't stumble upon any GPS logger coming with Tasker support (yet). And about "how to find the intent to start", we should switch roles (I'm asking, and you can answer) :) Would love to give a more convenient answer... – Izzy Dec 18 '14 at 12:50

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.