Example of app using FIT Contributor?

I was wondering if there is an example app, or some one willing to share some code to demonstrate how to add data to a FIT file from an app.
I got it working, with quite a few limits, in the simulator, but it does not work in the app that I uploaded to the store.
Limitations I encountered:

  • field data for MESG_TYPE_SESSION and MESG_TYPE_LAP can only be float; string always gives the error 'string too long for allocated space', other types show #VALUE# in the resulting FIT file on Monkeygraph
  • storing data for MESG_TYPE_RECORD and for MESG_TYPE_SESSION works well, for MESG_TYPE_LAP it shows a new lap for every datafield, and each lap has the data for the record
  • as I mentioned, it works in Monkeygraph, but I can not see the added fields in Garmin Connect, not on the web and not in the app.

I'd be grateful if someone could share a working example, that uses all message types and data types; if not, I will extract the relevant code from my app and share that.
    • field data for MESG_TYPE_SESSION and MESG_TYPE_LAP can only be float; string always gives the error 'string too long for allocated space', other types show #VALUE# in the resulting FIT file on Monkeygraph



    The default string length is 1 character. You need to use the :count option to set the length you want.

    Also note that the 32 byte limit for session messages applies to the total of all session message. If you write two session messages, the two message together need be less than 32 bytes. This seems to be true whether its a string or a byte array.

    Parameters:
    name (String) — The name of the Field as a string. The maximum length may vary between products. At least 64 bytes are availalble.
    fieldId (Number) — The unique Field Identifier for the Field
    type (type) — The type definiton for the field from the DATA_TYPE_ enumeration
    options (Dictionary) — Optional parameters that can be specified for field creation
    Options Hash (options):
    :count (Number) — Optional. The number of elements to add to the field if it is an array. This is also the maximum combined size of strings plus null terminators if the type is DATA_TYPE_STRING (Default 1). Apps are limited to 256 total bytes per message and data fields are limited to 32 bytes per message. Messages larger than the limit will result in a “New Field out of memory for FIT data” error.
    :mesgType (Number) — Optional. The message type that this field should be added to. Defaults to MESG_TYPE_RECORD if not provided. Note that if mesgType == MESG_TYPE_RECORD, DATA_TYPE_STRING cannot be used as the field type.
    :units (String) — Optional. The display units as a String. This should use the current device language. The maximum length may vary between products. At least 16 bytes are availalble.
    :nativeNum (Number) — Optional. If this field can be treated equivalently to a field that is included in the FIT SDK use this to indicate the Field Number that is specified by the FIT Profile. For reference see: Messages Sheet in Profile.xlsx included in the FIT SDK available at www.thisisant.com/resources/fit