UserProfile.getUserActivityHistory howto questions

Hi all,

First of all, kudo's for you all! Developing for Garmin seems to be asking for a lot patience :-)

I am playing around to see if I can create an app with some statistics for activities from the past. Lets say the last 12 to 24 months of activities.

I made the incorrect(?) assumption that I potentially could use UserProfile.getUserActivityHistory() for this and loop over all activities. At least for a basic start. Possibly there is some optimization possible. This seems to work ... however ...

I have 2 watches and I noticed my activity .fit files seem to be present on 1 of the 2 watches only. I had hoped that the unified training status feature would sync these. Unfortunately that syncs other metrics. My old watch is a FR745 and new one is a FR965. So looping over the activities does not give a complete result on either of these watches.

My questions:
1) Is it possible to interate over activities that are not available (yet?) on the watch? (different api call, download, ...)
2) Would manually copying fit files between the watches cause any problems?

My current super slow workflow is:
- try something like a println in vscode
- compile
- connect watch / copy prg file to watch / disconnect watch
- run app
- connect watch again
- look at log files
- repeat

This is because I do not seem to be able to supply activities to the app via the emulator.

Question 3: Any tips for improving my terrible workflow?


Thank you,

Jan

  • The activity files have much more data than is necessary for the TrueUp stuff. It doesn’t make sense to copy these (relatively) large files around.

  • Yeah I agree.

    Indeed, details like charts (HR, pace, and elevation) and the map are unavailable for activities synced via trueup. (Time in HR zones and training effect are available, tho)

    It is too bad that getUserActivityHistory can't iterate through these synced activities, considering that the data it returns is so basic (time of start, distance, duration, sport type).

  • Thank you all for the elaborate answers!

    "some statistics" may be a bit expressed to strong. Its more like some totals that I would really like to see on my watch. I see it as an excellent HelloWorld 2.0. I find my self checking these in GC and in Strava after a run. And since I check different totals in 2 different apps and just love my 965 display, I thought why not combine this into 1 app/glance :-)

    I copied 2 recent activities from the 965 to the 745 and they showed up in CIQ

    I think these are the conclusions:
    - you can loop through all currently available activities and (probably) save some summary data yourself on a location that is associated with your app
    - newly added activities will available and can be added to this summary data
    - summary data can probably not be generated again from scratch because older activities will have been deleted
    - this will only give statistics per watch (unless you start messing around with files)
    - possibly copying a lot of fit files to the watch can be used to regenerate the summary data, but this might be tricky.

    The next limit will probably be in storing persistent data on the device Relaxed

    Jan

  • Follow-up question

    I tried to get the simulator to feed activities to getUserActivityHistory. That did not seem to work and I tried working with a real watch.

    Armed with the information from FlowState, I was going to give the simulator a try again. I copied 1 fit file and it seems to show up with the getUserActivityHistory loop. However, I get 3 other entries. 2 of them with unix epoch dates from around a week ago and 1 with type null and startTime null. I guess this may be some garbage caused by me while trying to get the emulation to work. However, I do not see where these 3 extra entries are coming from and how to get rid of them.

    Any idea where I can find out where these activities are coming from? Or can I just delete some files or directories to reset?

    Thanks,

    Jan

  • File>Reset All App Data fixes it.

    And then copy the activity file again.