Need a better Activity API

Maybe I'm missing something but it seems impossible to be able to create custom Activity apps because the ActivityRecording API doesn't allow you to insert any data into the Activity FIT file. You can record a session and it will get HR, distance, time, calories automatically just like the built-in apps do but you can't add anything other than a custom field in the header or add a lap. So this might work for running, walking types of apps but it's useless for anything else. 

To give an example, I'm doing the 100 push-ups / day challenge so randomly during the day I do a set of push-ups. I could use the Strength Training app for that but then I'd get a new Activity for every set so my timeline would be littered with many each day. What I want is an app to keep track of each set and then roll them up into one Activity at the end of the day. I've written a simple app to record each set using the Storage api and that works fine, so I can keep track of how many I've done. Now for the hard part, how can I create an activity and add each set into it ? I'm really not bothered about HR, seconds, calories etc, but numbers of reps is kind of essential. 

Searching these forums, reveals that many people have hit a blank with this and many related tasks, e.g. creating swimming activities.

GARMIN: please advise if there's a way of doing this or please indicate a timeline for providing a more general purpose API. It seems at the moment, having the most sophisticated sportswatch on the market is actually useless for custom sports and I'd actually be better with something that has better general API's like WearOS or Apple (yuck).

  • From the way it sounds, what you want to do can be done today.  It wouldn't be a beginner app though.  You'd use fit contrib, and probably addLap so you can mark a set.

    Start recording, do your first set, then pause the recording (this is where you might want to use addLap and MSG_TYPE_LAP with fit contrib.  Stay paused until you want to do another set.

    The "pause" will likely need a menu with new set/save/discard.  End of day, you do the save.

    This means your activity will actually run all day (which can be a hit on the battery), but there will be a single fit, with your data.  So, when paused, you probably want to display the basic things you see on a watch face (time/date/etc)

    If you want the watch to actually count your pushups, you may want to look at the pitch counter sample in the SDK to see how it counts.

  • Start recording, do your first set, then pause the recording (this is where you might want to use addLap and MSG_TYPE_LAP with fit contrib.  Stay paused until you want to do another set.

    I don't think this will work because even though each set's work/rest period looks like a lap from CIQ's POV (in a datafield app), I don't think a lap that's added to the FIT file is interpreted as a set.

    Source: I recorded a Strength Training activity in a Connect IQ app, added several laps, and when I looked in Garmin Connect, the activity had no sets. Just as a sanity check, I changed the activity type to Cardio, and my laps were present.

    Besides, I doubt many users would be willing to run an activity all day.

  • It won't be pretty, but how else would you get multiple session spread over a day in the same .fit file?  One you save a .fit, that activity is over and each time you do a session, it would be a new fit file.

    What's your idea?

  • I didn't say I have a better idea.

    I said:

    1) Adding laps to a Strength Training activity via CIQ is not the same as adding sets natively. They won't show up as sets in Garmin Connect, and either way the CIQ app wouldn't be able to set reps / weight.

    To be clear, the additional problem here is that Garmin Connect won't even show laps at all for a Strength Training activity, which means that it won't help if the dev uses laps and sets reps / weight as developer fields. They would have to save the activity as a non-Strength Training type, which may not be what they want.

    2) Nobody wants to run an activity all day

    I wouldn't want someone to pursue the idea of adding laps as sets when there's no chance for it to work. (As I've gone down the same road myself.)

    As for better ideas, the OP wants CIQ apps to have more freedom when it comes to writing activities. I have a feeling this will never happen though. See the longstanding complaints about nativeNum fields in FitContributor - devs have complained that apps on a 3rd party platform (Apple Watch) have more freedom to write FIT files with native data like power, speed and cadence than non-native apps on Garmin's own watches. I get why Garmin wants to do things this way, but I also see why devs are frustrated.

  • So here's a couple of ways this kind of request could be fulfilled realistically (without asking Garmin to completely open up FIT file recording which will never happen):

    - Implement addSet() (with reps and weight) in the CIQ API

    - Allow CIQ apps to have Resume Later functionality when it comes to FIT file recording

  • Appreciate the suggestion, but as Flowstate says this just isn't practical. You wouldn't be able to run a watchface, another activity or any other app all day long so rendering your device pretty much useless. All I really need is the ability to create an activity at the end of the day and add the data to it. I'm currently doing this manually through the mobile app i.e. click new activity, selecting strength training, saving, and then adding each push-up set manually. So there's no time, no HR but it does have sets and reps which is all I need. Naively, I assumed that I'd be able to do this from the watch via the Activity API. I really don't see why Garmin would object to this, it's not undermining their ecosystem (quite the opposite). The only practical alternative now is to post the data to Google Fit via a web request and then use syncMyTracks to get it back into Garmin Connect which is just dumb ! 

  • There is no option to do anything different in CIQ than what I proposed, and the chances of that changing are next to nill.  "resume later" is what you are looking for, but not all Garmin devices even support that for native activities and I can't see that coming to CIQ, as it's been suggested many times over the years.

  • 'Resume later' would probably mean that I don't even need my app although it is a lot easier to use than the Strength Training app. Do Garmin read these forums and respond to requests and suggestions from developers ? It would seem a good way to stay ahead of the competition rather than just push devs onto another platform. 

  • Resume Later is available on some Forerunners and Fenix watches. I'm guessing you have a vivoactive (which doesn't have this feature).

    As Jim implied, since not all devices support Resume Later, it's doubtful that Garmin would add this feature to CIQ for devices which don't already have it. (So it wouldn't help you either way)

    And it is doubtful that Garmin will add this feature for CIQ at all, although anything's possible.

  • This has been request a number of times over the years, so the chances of seeing it are slim to none right now.  New features were announced in Oct at the GDVC, and specifically for 4.1 and 3.3 devices.