Cannot make FitContributions charts to work

I am trying to display charts on the Garmin Connect App trough FitCOntributions

these are the two fields I created in the .fit file that I am displaying with https://www.fitfileviewer.com/

I have created the fields like:

 _tempField = _session.createField(
    "temperature",
    0,
    FitContributor.DATA_TYPE_FLOAT,
    { 
        :mesgType => FitContributor.MESG_TYPE_RECORD, 
        :units => "°C" 
    }
);
_respField = _session.createField(
    "respiration",
    1,
    FitContributor.DATA_TYPE_FLOAT,
    {  
        :mesgType => FitContributor.MESG_TYPE_RECORD, 
        :units => "brpm"
    }
);

and I have in the resources file in resources/resources.xml

<resources>
    <fitContributions>
        <fitField 
            id="0" 
            displayInActivitySummary="true" 
            displayInChart="true"
            displayInActivityLaps="true"
            sortOrder="0" 
            precision="1" 
            dataLabel="@Strings.Temp" 
            unitLabel="@Strings.Celcius" 
		/>
		<fitField 
            id="1" 
            displayInActivitySummary="true" 
            displayInChart="true"
            displayInActivityLaps="true"
            sortOrder="1" 
            precision="0" 
            dataLabel="@Strings.Resp" 
            unitLabel="@Strings.Brpm" 
		/>
    </fitContributions>
</resources>

When I create the activity and save it to Garmin Connect I only see these 2 normal charts

I set the data correctly with setData, and it is showing correct in the .fit file

if (_session != null) {
   if (_tempField != null) {  
      _tempField.setData(_temperature);
   }
   if (_respField != null) {
      _respField.setData(_respiration);
   }
}
What am I doing wrong?
  • I found the answer, which is:

    I was using ActivityRecording instead of the new enum Activity in createSession

    Changed FROM

    _session = ActivityRecording.createSession({
                :name => "Sauna",
                :sport => ActivityRecording.SPORT_TRAINING,
                :subSport => ActivityRecording.SUB_SPORT_CARDIO_TRAINING
            });
    TO
    _session = ActivityRecording.createSession({
                :name => "Sauna",
                :sport => Activity.SPORT_TRAINING,
                :subSport => Activity.SUB_SPORT_CARDIO_TRAINING
            });
    If anyone encounter the same problem this is the solution.
  • This wasn't the reason, I'm pretty sure.