Summary/Session FIT Strings: Deciphered

After several iterations and testing, this is what appears to be true. And proper implementation is important to not create a Denial of Service attack on others...

  • You can write to the Activity FIT file more than one SESSION String from within your CIQ app. But the total pre-allocated size of all your strings can't exceed 32 characters. That can be in one string or split among many.
  • The Label and Units resource strings associated with these don't count as part of the Session String lengths... so only include actual variable data in the strings.
  • If multiple CIQ apps save Session Strings to the FIT file, Garmin Connect will still only respect up to 32 characters total in the post-activity report, so if you pre-allocate fields, you'll be preventing other CIQ apps from having their Session Strings show up in the post-activtiy report.
  • It isn't clear how Garmin decides which Session Strings to publish in the report, if there are multiple apps that write and the total exceeds 32 characters.
  • A good implementation should therefore setup a User Setting to allow users of your app to turn on or off Session Strings.
  • This flag should be used around the "create" AND the "setData" commands, since just pre-allocating the fields will consume those limited characters, even if you don't actually write to the fields.

if (UserSettings[SUMMARY_STRINGS] == true) {

FIT_SUMMARY_HYD = createField("HYDRATION STATS", 1, FitContributor.DATA_TYPE_STRING, {:mesgType=>FitContributor.MESG_TYPE_SESSION, :count => 12} );

FIT_SUMMARY_CAL = createField("CALORIE STATS", 2, FitContributor.DATA_TYPE_STRING, {:mesgType=>FitContributor.MESG_TYPE_SESSION, :count => 12} );

FIT_SUMMARY_TEMP = createField("TEMP STATS", 3, FitContributor.DATA_TYPE_STRING, {:mesgType=>FitContributor.MESG_TYPE_SESSION, :count => 7} );

}

  • If my understanding of the docs is correct, then all the fields (including non string) count to the 32 bytes

  • I write many fields to FIT and it produces a series of nice graphs in the Garmin Connect activity graph view. Some of my graph-based fields write every second. RECORD type fields don't include a "count" parameter so I don't think they are limited. But SESSION type fields are limited. I think there is also a LAP type, which I've never used... but I imagine those are also limited to 32 chars per lap.

  • There's a limit to the total number of fitcontrib fields.  And that's not a limit per CIQ DF, it's a limit for all CIQ DFs.

    If I recall, it's 16 fields, so if your DF writes 10, another CIQ DF can write 6 at most for example.