What I have done (showing for 1 field):
1. Added 'Fit Contributor' permission to the manifest
2. I added a 'fitcontributions.xml' file in a 'fitcontributions' subfolder of the resources folder (tried a raw fit.xml file in resources before as well) containing the following:
<resources>
<fitContributions>
<fitField id="0" displayInChart="true" sortOrder = "0" precision="2"
chartTitle="@Strings.LevelChartTitle" dataLabel="@Strings.LevelLabel"
unitLabel="@Strings.LevelUnit" fillColor="#FF0000" />
</fitContributions>
</resources>
3. Added relevant entries to the strings.xml
<string id="LevelChartTitle">Battery Level</string>
<string id="LevelLabel">battery_level</string>
<string id="LevelUnit">%</string>
4. Added the following code to the View.mc sourcefile
Added global
using Toybox.FitContributor as Fit;
using Toybox.System as Sys;
and inside the class (extending UI.DataField):
var batField;
const BATTERY_FIELD_ID = 0;
Then in 'function initialize()':
batField = createFieId( "battery_level",
BATTERY_FIELD_ID,
Fit.DATA_TYPE_FLOAT,
{:mesgType=>Fit.MESG_TYPE_RECORD, :units=>"%"}
);
In 'function compute(info)':
var battery = Sys.getSystemStats().battery;
batField.setData(battery);
The battery value is also shown in the field and is visible, it's a float...
Am I missing something? The chart doesn't pop up on connect, when I load the .fit file in monkeygraph nothing happens either... No errors, no messages, nothing.
Anyone a clue?