FitContributor Data Not Appearing in Garmin Connect - Can't Figure Out How To Debug

I'm working on a DataField that I've recently released, focused on walking activities, and I've added a feature to add activity step counting to FIT data. I'm fairly confident I've got the implementation right because I've looked at examples of how others have done it - and followed along (monkey c, monkey do Slight smile) - my app runs on the simulator and on my fenix 5x watch just fine, no crashes and I've attached the debugger to see that the correct data is being sent with a call to myField.setData(value) on every compute cycle. However, I just went for a test walk using my DataField and there's no sign of my activity step count in the Garmin Connect mobile app or Garmin Connect website.

I'm not really sure where to go from there - I've pulled the .fit file from the watch but I don't know how to open it - it isn't a plain text format, and I tried opening it in Monkeygraph but that didn't work (that app just seems to be flat broken for me - you select "Open FIT file", point at the file and press okay, and nothing happens - same with a .fit file exported from the simulator).

I'd loaded the app onto my watch with the Build For Device wizard - do I have to push it through the app store as a BETA for FIT contributions to work? Ideally I'd like to be able to test it in the simulator too.

  • You need to load it to the app store (you can have it set to a beta so only you can download it).  The info to understand your data is actully in the .iq file and garmin connect gets the info from the app store.

    It's similar to app settings.  It's got to be in the store.

    See the new developer faq wiki

  • Thanks Jim. I uploaded the DataField as a BETA and walked around my kitchen for a minute or so to record a new activity with the version loaded from the store. Still no step data in the activity in Garmin Connect on my phone unfortunately. I'm certain I was using the right version of the app because I renamed the app to avoid any confusion. What's the usual path one would go through to debug a FitContributor? I couldn't find a .iq file anywhere on my device or any reference to them in the SDK docs. I had a look at the developer wiki (hadn't come across that before), there's some stuff in there about settings not working unless you upload, but I didn't see anything specifically about FitContributor data.

    Feels like this is a somewhat dark corner of the SDK where the documentation is sketchy the debugging process is tricky. Any idea how I can get at the .iq file so that I can see what my watch recorded in Monkeygraph?

  • I've read in a few other threads that Monkeygraph is known to have a silent fail behaviour if you try to open a corrupt file, and that you can see the error if you open Monkeygraph from the command line. Now if only I could figure out how to do that... 

    wwarby@macbook bin % monkeygraph                             
    zsh: command not found: monkeygraph
    wwarby@macbook bin % ./monkeygraph                           
    zsh: ./monkeygraph: bad interpreter: /bin/bash^M: no such file or directory

  • Have you updated to the 3.1.9 SDK?  

  • delete it from your watch, turn the watch off and back on, and download it from the store again.  While you changed the name, things go by the manifest ID, and mixing a sideload and one from the store can sometimes confuse things.

  • Go Find the FitSDK from google. With this app, you can use the batch file (if on windows) or the Jar file (on Mac) and convert the fit to csv and then load it into a spreadsheet program.

    on the Mac (I see zsh, so I presume it's a Mac)

    java -jar fitcsv.jar session.fit

    21.32.00FIT SDK 21.32.00

    https://www.thisisant.com/developer/resources/downloads

  • Right, got it working now. Thanks @Nikeow - with your instructions I was able to convert my .fit file to a CSV file and confirm that my data was being written, and helped me understand where my underlying problems where. And Thanks @Jim - yeah, I had upgraded to SDK 3.1.9 and by renaming the app I mean that I had changed the appName string resource so that I could physically see on the watch itself that the name of the DataField I was assigning to my activity was the correct one - but nevertheless it was helpful to get rid of the sideloaded app completely and eliminate that as a possible source of interference. I finally figured out what a .iq file is - it's the app bundle itself Slight smile although I've obviously built it for upload a couple of times I hadn't recalled the file extension. Armed with that piece of information I was able to load the .iq file followed by the .fit file into Monkeygraph, which showed me that I had never set a value for my session field.

    It turned out that I had a few small, overlapping problems that were making this seem like a rather intractable problem to solve. For the benefit of anyone stumbling across this thread in the future, here's what I learned and where I had gone wrong:

    1. To view a .fit file from the watch in Monkeygraph, you must:
      1. Export the DataField for upload to the store as a .iq file
      2. Install the DataField onto the watch from the store (preferably as the only copy of the DataField on the watch to avoid accidentally using the wrong version)
      3. Record an activity on the watch
      4. Connect the watch via a cable to locate the .fit file in /Garmin/Activity (it'll be the most recent file).
      5. In Monkeygraph, first open the .iq file you exported for upload to the store. Nothing will appear to happen, but this step has made a crucial difference.
      6. Then open the .fit file in Monkeygraph
    2. The FitCSVTool mentioned by @Nikeow is actually a lot more useful than Monkeygraph in understanding what the watch has recorded.
      • The default command creates quite a complex file that is difficult to make sense of, but you can run these commands to see a clean representation of the session and lap data in CSV form:
        • java -jar fitcsvtool.jar ~/Desktop/activity.fit --defn none --data session
        • java -jar fitcsvtool.jar ~/Desktop/activity.fit --defn none --data lap
    3. Pay attention to the attributes displayInActivityLaps="true" and displayInActivitySummary="true" in the <fitField> elements in your <fitContributions> configuration (I actually had this bit right, but I saw another thread where somebody had missed this step, so thought it worth mentioning here). The data won't appear in Garmin Connect without these settings.
    4. The crucial thing I'd got wrong was a copy/paste error where I'd replaced all the SDK-defined constants in my code with literals to save memory (and that really does work) - but obviously makes you vulnerable to mistakes as I found out. I'd written 18 /* Fit.MESG_TYPE_SESSION */ when the true value of Fit.MESG_TYPE_SESSION is actually 20.
    5. When looking at lap data on the Garmin Connect app, you'll only see your own contributions to the table if you flip the phone on it's side. Because I hadn't done this, I thought the data was missing from both the session and lap, and therefore assumed my integration was flat broken - in fact it was writing lap data just fine and I wasn't looking for it in the right way, and session data was broken because of a typo in my code.
    6. This has been mentioned elsewhere but bears repeating: write your FIT contributions regularly by calling myField.setData() in the compute() handler, at least as often as the value of the data changes.

    Thanks again for the help guys - got there in the end Slight smile

  • If you look at the contents of a .iq file (it's actually a zip), you see that it's broken down by part number, and includes the .prg for that device, the debug.xml (helps if you want to look at a crash when you only see PC values in a stack trace) as well as json files for app settings and fitcontrib.

    This is why with a sideload you can't use app settings or view fitcontrib data, as the info on how to do those is actually in the .iq file and obtained from the store.

    This is why MonkeyGraph also needs the .iq, so it knows what to do with the fitcontrib data

  • Ah interesting, thanks! that's useful to know