Question about custom field in Garmin Connect created from Custom Sport App

There are many topics about custom field and I saw 2 sample applications (MO2Display and MoxyField) which are coming with Garmin Connect IQ SDK, but I still cannot find clear answers for these questions:

1. To create a custom field, only 3 things are enough from a coding point of view.

a. Create xml file like this

<resources xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="https://developer.garmin.com/downloads/connect-iq/resources.xsd">
    <fitContributions>
        <fitField id="0"
        displayInChart="false"
        sortOrder="0"
        precision="2"
        dataLabel="@Strings.my_data_label"
        unitLabel="@Strings.my_unit_label"
        displayInActivityLaps="true"
        fillColor="#0000ffff" />
    </fitContributions>
</resources>

b. In the code, do like this

//define field id like this
private enum FieldId {
	MY_FIELD_ID
}

//create field
_fitField = _session.createField(
	"MyField",
	MY_FIELD_ID,
	FitContributor.DATA_TYPE_STRING,
	{:mesgType=>FitContributor.MESG_TYPE_LAP, :count=>32}
);

//call this when I need to save the data
_fitField.setData(myFieldValue);

c. Permissions <iq:uses-permission id="FitContributor"/> inside manifest.xml.

Is it enough or do I miss something?

2. To see the fields, I must publish my app to Garmin store. If I just copy MyApp.prg file with MyApp-fit_contributions.json created by the build process to my watch, I will not see my custom fields in https://connect.garmin.com and in Garmin Connect mobile app. Is it correct, or can I still see the fields without publishing the app to Garmin store? I already tried it with copying prg file and I see fields inside.fit file if I download activity as .fit file, but I do not see these fields in UI (https://connect.garmin.com or in Garmin Connect mobile app).

3. Are custom fields usually visible in both https://connect.garmin.com and in Garmin Connect mobile app or only one place? Maybe can someone share a few screenshots how custom fields look like?

4. Are custom fields available for all sport types or only for some specific sport types? I am specifically interested in SPORT_GENERIC.

  • Actually you are right, I have to call setData every second at the end, otherwise it was randomly working or not.
    About the string data this app https://apps.garmin.com/en-IL/apps/a478d5f2-0a0a-4ba3-87aa-4832e97007ed uses activity summary numerical data and it works in both, Garmin connect mobile app and website. But it is only numerical data.

  • About the string data this app https://apps.garmin.com/en-IL/apps/a478d5f2-0a0a-4ba3-87aa-4832e97007ed uses activity summary numerical data and it works in both, Garmin connect mobile app and website. But it is only numerical data.

    Well the Connect app and Connect website have been known to have different bugs when it comes to CIQ developer FIT fields.

    At one point the Connect app would display developer fields, but the Connect website. At another point it was the other way around.

    What you're seeing with lap string data being shown in the app and not the website seems like the latest bug/inconsistency.

    I do think it's very unusual to display a string for CIQ lap data. I've never seen that before. Usually lap data is either a total, max, or average of instant data for the lap (MESG_TYPE_RECORD), meaning it's typically a number (integer or float).