addLap() & Widgets

Hi - two quickies.

1. Can I use addLap() from a Widget to inject a programmable auto-lap into an activity? I want a TIME based auto-lap, not distance or location based. So my crew can calibrate calorie and hydration needs during LONG crewed endurance races.

2. I want a full screen of lap metrics once the time-based (1 hour) lap triggers. But I don't want to have that screen up all the time. If I code this as a Widget, can that code run in the background and when the 1 hour timer expires, it switches to it's view with all the lap metrics? Or, is a Widget like a Data Field, and the code only runs when the Widget is displayed?

The basic idea is to run code in the background to trigger once every "n" minutes, and then auto-display an entire screen full of information, switching from the primary display of data fields.

Thanks for any tips.
  • 1. Can I use addLap() from a Widget to inject a programmable auto-lap into an activity? I want a TIME based auto-lap, not distance or location based. So my crew can calibrate calorie and hydration needs during LONG crewed endurance races.

    The ActivityRecording module isn't available to the widget application type. It is only available to full-blown applications. Additionally, a data field can access the state of the recording, but it can't trigger an actual lap.

    2. I want a full screen of lap metrics once the time-based (1 hour) lap triggers. But I don't want to have that screen up all the time. If I code this as a Widget, can that code run in the background and when the 1 hour timer expires, it switches to it's view with all the lap metrics? Or, is a Widget like a Data Field, and the code only runs when the Widget is displayed?

    Since you can't use a widget to solve this problem, the question is no longer relevant. If you write a full-blown application, you'll be writing all of the code to manage the session and the view, so you'll have full control. You can push/pop/switch views whenever you want.

    Travis
  • If you do decide on doing a full blown recording app, RecordSample in the SDK is a very minimal one. It fires up GPS, creates the session, starts recording, stops recording, saves recording. The whole thing is under 200 lines of code but it shows the basics.

    But, it's very minimal. As Travis mentioned, you got to do the whole display of info and multiple pages/views etc, as well as enabling sensors like the HRM, coding to do auto-laps if you want, pausing the recording, allowing "discard" of a recording, showing the "lap" screen, etc., so a full blown app can take some time.