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.