Fit contributor lap data not showing up on garmin connect web or mobile

I have a simple data field that is trying to save data to fit file.  I have it saving record, session and lap data.  I can see the record and session data on garmin connect web and mobile but the lap data is not showing up.  I can see the lap data being saved in the fit fille using java -jar fitcsvtool.jar activity.fit --defn none --data lap.

I have a fit.xml file in the resources folder as below:

<fitContributions>
    <!-- RECORD : Record Chart Definitions -->
    <fitField id="0" displayInChart="true" sortOrder="0" precision="2" chartTitle="@Strings.FITNESSTITLE" dataLabel="@Strings.FITNESSLABEL" unitLabel="@Strings.KPH" fillColor="#ff7b00" />

    <!-- SESSION : Session Data Definitions -->
    <fitField id="1" displayInActivitySummary="true" sortOrder="1" precision="2" dataLabel="@Strings.FITNESSLABEL2" unitLabel="@Strings.KPH2" />

    <!-- LAP : Lap Data Definitions -->
    <fitField id="2" displayInActivityLaps="true" sortOrder="2" precision="2" dataLabel="@Strings.FITNESSLABEL3"  unitLabel="@Strings.KPH3" />
</fitContributions>

and strings.xml looks like this:

<strings>
    <string id="AppName">RTFC</string>
    <string id="FITNESSTITLE">Fitness</string>
    <string id="FITNESSLABEL">Fitness</string>
    <string id="FITNESSLABEL2">Avg Fitness</string>
    <string id="FITNESSLABEL3">Avg Fitness</string>
    <string id="KPH">kph</string>
    <string id="KPH2">kph</string>
    <string id="KPH3">kph</string>
</strings>

I have this in function initialize() to create the fields:

        FitFit = createField(
            "FITNESS",
            0,
            FitContributor.DATA_TYPE_FLOAT,
            {:mesgType=>FitContributor.MESG_TYPE_RECORD, :units=>"kph"}
        );
        FitFitSum = createField(
            "FITNESS",
            1,
            FitContributor.DATA_TYPE_FLOAT,
            {:mesgType=>FitContributor.MESG_TYPE_SESSION, :units=>"kph"}
        );
        FitFitLap = createField(
            "FITNESS",
            2,
            FitContributor.DATA_TYPE_FLOAT,
            {:mesgType=>FitContributor.MESG_TYPE_LAP, :units=>"kph"}
        );

        FitFit.setData(0.0);
        FitFitSum.setData(0.0);
        FitFitLap.setData(0.0);

and this in function compute()

     if (info != null && thingtoreturn != null) {
        // Record
            FitFit.setData(thingtoreturn);
        // Session
            Scounter++;
            bigMean += thingtoreturn;
            FitFitSum.setData(bigMean / Scounter);
        // Lap
            Lcounter++;
            lapMean += thingtoreturn;
            FitFitLap.setData(lapMean / Lcounter);
        }

and this bit to reset the lap value:

    public function onTimerLap() as Void {
    //! Handle lap event
        Lcounter = 0;
        lapMean = 0.0;
    }

I can see the fit data in activity_data.csv made from running java -jar fitcsvtool.jar activity.fit --defn none --data lap against a real or simulated fit file:

and activity.csv made in same way:

But I have no lap data in garmin connect mobile (even if I scroll right) or web (I do get session and record data).

There seem to be threads from a few years back which say that garmin connect web and/or mobile is not to be trusted for fit data viewing but I figured this would be fixed by now.  I also spent some time in monkeygraph which again works well for session and record data but seems flaky with lap data. I was wondering if I had too many native lab fields and this was causing the issue... 48 seems like a lot.

Please help, thanks!

  • In GCM (at least for Android app) you have to be in landscape orientation so that scroll right works. Otherwise, only first native lap values will be displayed and scrolling will move to other screens

  • Yeah sorry I should have said I am all the way right in horizontal view and my field is not there:

  • With fit contrib data to show, your app needs to be installed from the app store, and not sideloaded.

    And the fitcontrib data in the xml for your app defines what and how things are displayed.  Like this:


         <fitContributions>
            <fitField id="0" displayInChart="true" chartTitle="@Strings.temp_title" fillColor="ff0000" sortOrder = "1" precision="2" displayInActivityLaps="false"
            dataLabel="@Strings.temp_label"
            unitLabel="@Strings.temp_units"/> 
         </fitContributions>

    Then when a fit file is synced and displayed, garmin connect gets the info on how and what fitcontrib data is displayed is obtained from the app store, not from your app.  That info in the .iq file you uploaded to the store.

    This is why with monkeygraph, you pass and iq file - so it knows the same info.  If you don't see things in monkeygraph. even if the file is fine, you wont see the fitcontrib data unless the json file used to display it is also fine.

    When you test in the sim, that json file is in the bin folder, and with what I show above, here is the json file:

    {"datafields":[{"id":0,"chart-visible":true,"activity-visible":false,"lap-visible":false,"chart-title-key":"temp_title","label-key":"temp_label","unit-label-key":"temp_units","sort-order":1,"precision":2,"fill-color":"rgba(255, 0, 0, 1.0)"}],"strings":{"default":{"temp_title":"piTemp","temp_label":"Temp","temp_units":"F"}}}

    The json file is included in the iq file when you export the app.  And when you upload the app, garmin connect gets that jso from the app-store to know how display fitcontrib data.

    This kind of similar to app-settings where they only work if something is installed from the store, because there's a json file in the iq that defines the settings.

    So make sure you code aligns with the xml for fitContrib, the json for that looks correct, you build an iq, use monkeygraph to see how that looks, upload the iq file to the store, and install the app from there.

  • Thank you for your response.

    I am downloading my app from the app store and not sideloading so I don't think it is that.

    my fit.xml seems to follow exactly the format of yours too:

    <fitContributions>
        <!-- RECORD : Record Chart Definitions -->
        <fitField id="0" displayInChart="true" sortOrder="0" precision="2" chartTitle="@Strings.FITNESSTITLE" dataLabel="@Strings.FITNESSLABEL" unitLabel="@Strings.KPH" fillColor="#ff7b00" />
    
        <!-- SESSION : Session Data Definitions -->
        <fitField id="1" displayInActivitySummary="true" sortOrder="1" precision="2" dataLabel="@Strings.FITNESSLABEL2" unitLabel="@Strings.KPH2" />
    
        <!-- LAP : Lap Data Definitions -->
        <fitField id="2" displayInActivityLaps="true" sortOrder="2" precision="2" dataLabel="@Strings.FITNESSLABEL3"  unitLabel="@Strings.KPH3" />
    </fitContributions>

    The APPNAME-fit_contributions.json file in my bin again seems to also have exactly the same format as your example:

    {"datafields":[{"id":0,"chart-visible":true,"activity-visible":false,"lap-visible":false,"chart-title-key":"FITNESSTITLE","label-key":"FITNESSLABEL","unit-label-key":"KPH","sort-order":0,"precision":2,"fill-color":"rgba(255, 123, 0, 1.0)"},{"id":1,"chart-visible":false,"activity-visible":true,"lap-visible":false,"chart-title-key":null,"label-key":"FITNESSLABEL2","unit-label-key":"KPH2","sort-order":1,"precision":2,"fill-color":null},{"id":2,"chart-visible":false,"activity-visible":false,"lap-visible":true,"chart-title-key":null,"label-key":"FITNESSLABEL3","unit-label-key":"KPH3","sort-order":2,"precision":2,"fill-color":null}],"strings":{"default":{"FITNESSTITLE":"Fitness","FITNESSLABEL":"Fitness","KPH":"kph","FITNESSLABEL2":"Avg Fitness","KPH2":"kph","FITNESSLABEL3":"Avg Fitness","KPH3":"kph"}}}

    I did a 6 minute simulation with 5 lap presses (6 laps) and loading the up iq and then the session as you describe the monkeygraph output is below:

    record looks fine (should be no data for first 4 mins as output settles down).

    first 3 laps are correct numerically (first 2 should be 0.0 kph) but naming of the laps seems to be off*, next 3 laps have #value? instead of names/values. Field name for the laps is 'Fitness' while 'Avg Fitness' is a string from the session fitfield so don't understand how that is getting in here.

    Session data is also fine:

    The thing I don't get is I am using the same approach for all the fitcontributions but only the laps aren't working, the session and record parts are working fine across all views.

    Thanks again for your help.

  • What do you see in monkeygraph?

  • I‘m not a pro, but I use Contribute in my datafields, too.
    I use different names for the fields.
    You use the same fieldname „FITNESS“ for Sum and Lap. 
    Maybe a problem?

  • All the bits of monkeygraph I’m aware of are screengrabbed in my previous reply to you. Maybe there is another part of monkeygraph or maybe the images aren’t showing for you?

  • Figure out what's going on with MonkeyGraph and your app.  Looks to me it may be connected to how you are doing the setData for lap data.  Remember, what setData does is set the data for the next time a lap is saved to the fit and not right away.

  • Thank you that is a good catch. Sadly I just tested making these unique and it did not help.

  • I did a 6 minute simulation with 5 lap presses (6 laps) and loading the up iq and then the session as you describe the monkeygraph output is below:

    In this case:

    - Did you press Activity Data > Stop to stop the activity and Activity Data > Save to finalize the FIT file? In the past, I've found I was able to save the FIT file without stopping and saving the activity, but this resulted in a corrupt FIT file which didn't work properly in monkeygraph.

    - Did you try examining the FIT file with fitcsvtool / FIT2CSV as before? How do the actual values compare to what monkeygraph displays?