Fit Contributer App Examples

Hey guys, 

Does anyone know of any code examples I can look at , of how to modify an APP that is already setup to record a session, to add extra fit fields into the recording? 

I tried this from the RecordSample , but I'm getting symbol createField unknown for some reason, I am missing something here.

... I think it's a scope issue, but I don't know how to remedy it

using Toybox.WatchUi;
using Toybox.ActivityRecording;
using Toybox.Timer;
using Toybox.System;
using Toybox.FitContributor;

var session = null;
    var WindAxisField = null;
    var WindSpeedField = null;

	const WINDAXIS_FIELD_ID = 0;
	const WINDSPEED_FIELD_ID = 1; 
	

	
class SailRacerDelegate extends WatchUi.BehaviorDelegate {
		
    function initialize() {
        BehaviorDelegate.initialize();
       
        WindAxisField = createField( " Wind Axis " , WINDAXIS_FIELD_ID, FitContributor.DATA_TYPE_FLOAT, {:mesgType=> FitContributor.MESG_TYPE_SESSION, :units=>" Degrees "});
		WindAxisField.setData($.gwindaxis);
	System.println("wwwiiiiiiiinnnnnnnnndddddddddaaaaaaaaaxxxxxxxxxiiiiiiiiissssssssrecorded");
		WindSpeedField = Field.createField(
            " Wind Speed ",
            WINDSPEED_FIELD_ID,
            FitContributor.DATA_TYPE_FLOAT, {:mesgType=>FitContributor.MESG_TYPE_SESSION, :units=>" Kts "});
			WindSpeedField.setData($.gwindspeed);    
    
        
    } 

  • You want to use session.createField, which means you want to have created the session first.  There's info about how to do this in the Programmer's guide under Fit Developer Fields.

    Move the createField to after the createSession, and use the session to create the field.