Data field internal variables configuration

Hello:

I'm writting a Data Field for some power stuff and I have an internal variable containing the number of seconds to perform the related average power computations. Until now I must hardcode this variable and recompile the data field after each modification. Exists any way to write a Data Field that asks for this internal variable value when it is selected in the device or via the mobile phone app configuration?
  • Use "App settings".

    See the programmer's guide in the SDK - look for "Changing Settings Within Garmin Connect Mobile/Garmin Express"

  • Thank you for the point. I've written first a properties.xml file in the folder resources (I have seen this location fir the settings in the SDK examples):
    <resources>
    <properties>
    <property id="myprop_val" type="number">1</property>
    </properties>
    <strings>
    <string id="myprop_tit">My variable</string>
    </strings>
    <settings>
    <setting propertyKey="@Properties.myprop_val" title="@Strings.myprop_tit">
    <settingConfig type="numeric" min="0" max="5" required="true"/>
    </setting>
    </settings>
    </resources>


    Then, I have this code:
    using Toybox.WatchUi as Ui;
    using Toybox.Application as App;
    class myDataFieldView extends Ui.DataField
    {
    var myprop;
    function initialize()
    {
    DataField.initialize();
    myprop = App.Properties.getValue("myprop_val");
    }
    .
    .
    .
    }


    The data field compiles without problem and I can run the App Settings Editor in Eclipse, change the variable and send it to the simulator. But the problem is that I can't found the way to configure the variable in the Garmin Connect app, not in Garmin Express. The Data field works perfectly in the device, but with the defined default value. How can I change the variable content in Garmin Connect and Garmin Express?

    Thanks
  • Ok, now look at the New Developer FAQ sticky. There's a part about testing app settings (the app has to be in the store to use GCM or GE, but you can make the app as "beta" so only you can down load it).

    Also, look at point 10 in the FAQ, to cover for a long standing problem with Numbers and Android.