Activity object in Watch Apps

I would like to use the Activity object in my Watch App, specifically the timer. I can see that there is an Activity object; Activity.getActivityInfo() returns a valid object. But its timerState is TIMER_STATE_OFF, and I see no way to start or stop the timer. Do I just need to use my own timer object? In that case what is the utility of the Activity object for Watch Apps? 

  • That is only available if you are recording an activity, which you can't do in a watch face.

    in a watch face, there are a few handy things you can get like currentHeartRate, but much of it won't be valid.

    Creating your own timer in a WF is a bit tricky as you can only do it if you're not in low power mode.

  • Thanks, but this is a full Watch App, not a Watch Face. The "APIs and App Types" capability matrix shows that Apps do have access to the Activity module.

  • So to access the timer/timer state in Activity, you need to create a session and start recording.  See ActivityRecording or the RecordSample in the SDK.

    Otherwise, you can create your own timer to track things.  Either way, your app controls when things start/stop etc usually buy way of user input.

  • Perfect, thank you! Somehow I was missing the ActivityRecording API. I'd looked at it and saw that it was about FIT files.

  • A .fit is created when you record, but your app can always discarded the recording.

    I'm not sure what you're wanting to do but it may actually be easier to just use your own timer if you don't want to record a .fit.

  • Actually recording the .fit is a bonus, just not what I was looking for at the time. I'm writing a custom app for pacing a 6-day race. My first thought was I'd want to use my own timer, but the only interface Timer provides is a callback every so many milliseconds... first this loses the ability to determine the exact elapsed time e.g. when the lap button is pressed, plus I was worried that if I simply added one second over six days I might lose precision. I realized I could just use the timer to update the views, and get the actual time from the System time, but ActivityRecording is actually what I want.