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

  • Lets say the last 12 to 24 months of activities.

    The devices can only store a limited number of activity files (like 200). If there are more than that, the oldest file is deleted (to make room for the new/current activity).

  • I was afraid of that. After seeing 199 and 198 on the watches :-)

  • 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.

    I'm pretty sure the activity files are not copied around.

    1) Is it possible to interate over activities that are not available (yet?) on the watch? (different api call, download, ...)

    You wouldn't want to download these files. Downloading is often (with BT) very, very slow. IQ doesn't let you download activity files anyway.

    There is an API to the Garmin Connect website but it's not publicly available. You might be able get access to it if you are "big company" but probably not otherwise.

  • I'm not really sure if devices (watches) are even a good place to do a "deep dive" into one's history.

    Seems it would be better to do that on a bigger/faster computer (like a smartphone).

    It seems the "philosophy" of IQ is for more immediate "in the moment" uses.

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

    The simulator has a temporary folder which mirrors the layout of the folders on your device.

    On Windows: %TEMP%\com.garmin.connectIQ\GARMIN

    On macOS: $TMPDIR/garmin.connectIQ/GARMIN

    If you copy activity FIT files to GARMIN\Activities, your app running in the simulator *should* be able to access them. (Just tried it out with 1 activity FIT file and it worked.)

    Note: the name of the activity folder in the sim seems to be Activities, although the name of the same folder on a real device is Activity.

    I agree that the watch isn't the best place to look at 1-2 years of history, since activities are auto-deleted after a certain point. (Older watches had severely limited storage.)

    1) Is it possible to interate over activities that are not available (yet?) on the watch? (different api call, download, ...)

    Ppl have used python scripts or js scripts (running in the browser console) to download activities. They basically replicate the same network calls that are made when you manually log into the Connect website and browse your activities, but automated and in bulk.

    The most popular python script for this purpose does have a disclaimer that using it *might* lead to an account ban. I've used it in the past without problems.

    github.com/.../garmin-connect-export

    2) Would manually copying fit files between the watches cause any problems?

    I don't think there would be any problems (training metrics wouldn't be affected afaik). I actually have done this in the past (when I had a race or two that I wanted to copy from an old watch to a new watch, just so it would be available in history).

  • dpawlyk said:
    I'm pretty sure the activity files are not copied around.

    I think there may be a one time sync of activities when a new device is added with Physio TrueUp enabled (the last 75 days worth, according to Garmin). I have seen this when I got a new watch a a year and half ago.

    support.garmin.com/.../

    Someone in the forums also reported that recent activities are synced between their Edge and their watch. The same support article mentions that the last activity / last run / last ride widgets are synced, without really elaborating on how that works (are the FIT files literally synced over)?

  • The TrueUp doesn’t appear to copy activity files. 

  • I don’t think you can get much info from the activity files anyway.  IQ doesn’t let you do much with files. 

  • dpawlyk said:
    The TrueUp doesn’t appear to copy activity files. 

    You're right, the activity FIT files themselves are apparently not copied. (At least they don't show up in \GARMIN\Activity\)

    I have seen TrueUp make recent activities from an old device (FR945LTE) available on a new device (FR955), in the watch's UI. This happened when I set up the new device and synced it.

    And just now, I was able to make roughly one month of recent activities from my new device appear on my old device (in the UI), but only after recording an activity on the old device. (Maybe I hadn't used it in so long that Garmin treated it as a dormant device.)

    And someone else on the forums noted that activities from their Edge appear on their watch (in the UI), on an ongoing basis.

    But yeah, it seems that the FIT files do not show up in \GARMIN\Activity. I'm not sure whether that means the activity data is available via CIQ or not. (I might try this out.)

    dpawlyk said:
    I don’t think you can get much info from the activity files anyway.  IQ doesn’t let you do much with files. 

    I agree. I don't really care so much about the files themselves, just whether activities from one device can show up on another device.

    I'm also curious whether activities from other devices which appear in a device's UI due to TrueUp are accessible via the CIQ activity history API. I agree that CIQ activity history itself is not the greatest way to access huge amounts of history (or even any amount of history), but I'm still curious.

  • I tried it out, and indeed, getUserActivityHistory() only shows data for FIT files in \Garmin\Activity (whether originally recorded by the device, or manually copied over).

    getUserActivityHistory() does not return activities which were "synced" via trueup (such that they show up in the UI, but not \Garmin\Activity).