<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="https://forums.garmin.com/cfs-file/__key/system/syndication/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Writing to .fit files from a datafield app</title><link>https://forums.garmin.com/developer/connect-iq/f/discussion/285/writing-to-fit-files-from-a-datafield-app</link><description>Hi,
 
 I&amp;#39;ve published a first version of a data field for garmin 920xt, and wonder if it will be possible to write data to the .fit file from tha IQ SDK.
 
 Regards and thanks for IQ, it&amp;#39;s great !
 
 Rafael</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Wed, 30 Mar 2022 16:42:38 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://forums.garmin.com/developer/connect-iq/f/discussion/285/writing-to-fit-files-from-a-datafield-app" /><item><title>RE: Writing to .fit files from a datafield app</title><link>https://forums.garmin.com/thread/1399115?ContentTypeID=1</link><pubDate>Wed, 30 Mar 2022 16:42:38 GMT</pubDate><guid isPermaLink="false">a9571b57-dd57-479e-8763-8f8a603e40aa:37452747-b7d4-4721-95e4-03af3c5ff4b8</guid><dc:creator>trudelta</dc:creator><description>&lt;p&gt;By build the .iq file you mean Export Project?&amp;nbsp; That I have done.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Writing to .fit files from a datafield app</title><link>https://forums.garmin.com/thread/1399114?ContentTypeID=1</link><pubDate>Wed, 30 Mar 2022 16:40:45 GMT</pubDate><guid isPermaLink="false">a9571b57-dd57-479e-8763-8f8a603e40aa:c1aa83a9-39ce-4532-9c2d-49683d8d64d9</guid><dc:creator>jim_m_58</dc:creator><description>&lt;p&gt;You need to build the .iq file that has the json files in it.&amp;nbsp; That&amp;#39;s how monkeygraph knows what to do with the data.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Writing to .fit files from a datafield app</title><link>https://forums.garmin.com/thread/1399113?ContentTypeID=1</link><pubDate>Wed, 30 Mar 2022 16:38:02 GMT</pubDate><guid isPermaLink="false">a9571b57-dd57-479e-8763-8f8a603e40aa:dc29b77d-f497-4bce-9906-e505ca209745</guid><dc:creator>trudelta</dc:creator><description>&lt;p&gt;Thanks.&amp;nbsp; Now I got&amp;nbsp;&lt;span&gt;fit_contributions.jso files generated.&amp;nbsp; The documentation says I can preview a graph in Monkey Graph.&amp;nbsp; So I ran an activity data simulation, saved a FIT file but Monkey graph doesn&amp;#39;t show any graph.&amp;nbsp; After loading the IQ file and FIT file, the program still shows the Monkey playing on the PC picture.&amp;nbsp; What&amp;#39;s up in this case?&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Writing to .fit files from a datafield app</title><link>https://forums.garmin.com/thread/1399109?ContentTypeID=1</link><pubDate>Wed, 30 Mar 2022 16:15:21 GMT</pubDate><guid isPermaLink="false">a9571b57-dd57-479e-8763-8f8a603e40aa:fd71ed28-1621-4335-8f30-f831f27da863</guid><dc:creator>jim_m_58</dc:creator><description>&lt;p&gt;He goes under resources.&amp;nbsp; Here&amp;#39;s what I often do:&lt;br /&gt;&lt;br /&gt;&lt;img src="https://forums.garmin.com/resized-image/__size/320x240/__key/communityserver-discussions-components-files/12/pastedimage1648656844085v1.png" alt=" " /&gt;&lt;/p&gt;
&lt;p&gt;The fitcontrib.xml is what I posted a while back.&amp;nbsp; It&amp;#39;s app specific so you need to do your own.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Writing to .fit files from a datafield app</title><link>https://forums.garmin.com/thread/1399101?ContentTypeID=1</link><pubDate>Wed, 30 Mar 2022 16:01:38 GMT</pubDate><guid isPermaLink="false">a9571b57-dd57-479e-8763-8f8a603e40aa:1abee15c-679c-41d3-a31f-43ac6cb62346</guid><dc:creator>trudelta</dc:creator><description>&lt;p&gt;I looked in a couple of the part number folders.&amp;nbsp; Just to be clear, I have to manually create&amp;nbsp;&lt;span&gt;fitContrib.xml right?&amp;nbsp; Where do I put it?&amp;nbsp; &amp;nbsp;The documentation is not clear on this.&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Writing to .fit files from a datafield app</title><link>https://forums.garmin.com/thread/1399092?ContentTypeID=1</link><pubDate>Wed, 30 Mar 2022 15:49:23 GMT</pubDate><guid isPermaLink="false">a9571b57-dd57-479e-8763-8f8a603e40aa:2472c2b2-028f-4a95-a85d-4fad9475dbe7</guid><dc:creator>jim_m_58</dc:creator><description>&lt;p&gt;It will be in a folder for a part number along side the prg.&lt;/p&gt;
&lt;p&gt;Where do you have your xml file?&amp;nbsp; Induce an error in it and rebuild your app.&amp;nbsp; It will give you a warning/error if it&amp;#39;s in the proper place.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Writing to .fit files from a datafield app</title><link>https://forums.garmin.com/thread/1399082?ContentTypeID=1</link><pubDate>Wed, 30 Mar 2022 15:37:24 GMT</pubDate><guid isPermaLink="false">a9571b57-dd57-479e-8763-8f8a603e40aa:34b62fa8-ef5e-4540-acb3-8d287c907685</guid><dc:creator>trudelta</dc:creator><description>&lt;p&gt;I think I followed everything required.&amp;nbsp; I looked in the iq file and there is no&amp;nbsp;&lt;span&gt;fit_contributions.jso file.&amp;nbsp; What could be the cause?&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Writing to .fit files from a datafield app</title><link>https://forums.garmin.com/thread/1396142?ContentTypeID=1</link><pubDate>Wed, 23 Mar 2022 18:41:12 GMT</pubDate><guid isPermaLink="false">a9571b57-dd57-479e-8763-8f8a603e40aa:bb115f6c-16c1-4d7f-9396-52e098c2a239</guid><dc:creator>jim_m_58</dc:creator><description>&lt;p&gt;It&amp;#39;s used when you compile to build the fit_contributions.jso which is included in the iq file for the store.&lt;/p&gt;
&lt;p&gt;For example, in a DF initialize(), I have this:&lt;/p&gt;
&lt;p&gt;field=createField(&amp;quot;piTemp&amp;quot;,0,FitContributor.DATA_TYPE_FLOAT, {:mesgType =&amp;gt; FitContributor.MESG_TYPE_RECORD});&amp;nbsp;&lt;/p&gt;
&lt;p&gt;in compute, this:&lt;/p&gt;
&lt;p&gt;field.setData(tempValue);&lt;/p&gt;
&lt;p&gt;And the fitContrib.xml has this:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;&amp;lt;resources&amp;gt;
    &amp;lt;strings&amp;gt;
    	&amp;lt;string id=&amp;quot;temp_label&amp;quot;&amp;gt;Temp&amp;lt;/string&amp;gt;
    	&amp;lt;string id=&amp;quot;temp_units&amp;quot;&amp;gt;F&amp;lt;/string&amp;gt;
    	&amp;lt;string id=&amp;quot;temp_title&amp;quot;&amp;gt;piTemp&amp;lt;/string&amp;gt;
    &amp;lt;/strings&amp;gt;
    
     &amp;lt;fitContributions&amp;gt;
        &amp;lt;fitField id=&amp;quot;0&amp;quot; displayInChart=&amp;quot;true&amp;quot; chartTitle=&amp;quot;@Strings.temp_title&amp;quot; fillColor=&amp;quot;ff0000&amp;quot; sortOrder = &amp;quot;1&amp;quot; precision=&amp;quot;2&amp;quot; displayInActivityLaps=&amp;quot;false&amp;quot;
        dataLabel=&amp;quot;@Strings.temp_label&amp;quot;
        unitLabel=&amp;quot;@Strings.temp_units&amp;quot;/&amp;gt;
     &amp;lt;/fitContributions&amp;gt;
&amp;lt;/resources&amp;gt;&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;The result is this graph:&lt;br /&gt;&lt;img src="https://forums.garmin.com/resized-image/__size/320x240/__key/communityserver-discussions-components-files/12/pastedimage1648060865209v1.png" alt=" " /&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Writing to .fit files from a datafield app</title><link>https://forums.garmin.com/thread/1396135?ContentTypeID=1</link><pubDate>Wed, 23 Mar 2022 18:14:56 GMT</pubDate><guid isPermaLink="false">a9571b57-dd57-479e-8763-8f8a603e40aa:f907c1e4-94c0-42d7-9738-80aa40f5d6a5</guid><dc:creator>trudelta</dc:creator><description>&lt;p&gt;Thanks,&lt;/p&gt;
&lt;p&gt;Can you explain this more ? ==&amp;gt;&lt;/p&gt;
&lt;p&gt;&amp;gt;&amp;gt;&amp;nbsp;&lt;span&gt;You need to have the xml file that defines how that data will be displayed in Garmin Connect, and for that data to be displayed&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;Do I need to create an XML file or does the user do it somehow manually or automatically?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Writing to .fit files from a datafield app</title><link>https://forums.garmin.com/thread/1396127?ContentTypeID=1</link><pubDate>Wed, 23 Mar 2022 17:52:01 GMT</pubDate><guid isPermaLink="false">a9571b57-dd57-479e-8763-8f8a603e40aa:92d995d2-7009-4da3-b696-a3f65e530721</guid><dc:creator>jim_m_58</dc:creator><description>&lt;p&gt;You need to createField(), and make sure you have the data you want for that field at all times using setData() (I do it in compute() on every call.)&lt;/p&gt;
&lt;p&gt;You need to have the xml file that defines how that data will be displayed in Garmin Connect, and for that data to be displayed, the DF needs to be installed from the app store.&lt;/p&gt;
&lt;p&gt;As far as the field ID, it&amp;#39;s really not just a 0.&amp;nbsp; It&amp;#39;s a combo of that plus your app ID, so it&amp;#39;s only got to be unique in your data field.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Writing to .fit files from a datafield app</title><link>https://forums.garmin.com/thread/1396092?ContentTypeID=1</link><pubDate>Wed, 23 Mar 2022 17:09:47 GMT</pubDate><guid isPermaLink="false">a9571b57-dd57-479e-8763-8f8a603e40aa:fb997920-7e4c-48ec-957b-857f3570ffc4</guid><dc:creator>trudelta</dc:creator><description>&lt;p&gt;I&amp;#39;m trying to get this to work as well. I followed the bananas earned example on this page:&lt;/p&gt;
&lt;p&gt;&lt;a href="https://developer.garmin.com/connect-iq/api-docs/Toybox/FitContributor.html"&gt;https://developer.garmin.com/connect-iq/api-docs/Toybox/FitContributor.html&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;but no data is saved for my custom datafield after the activity (walk) is completed and saved.&amp;nbsp; Is there something else that I need to do?&amp;nbsp; Also I set the field ID to 0, but how do I know if this conflicts or not with an existing ID that may be being used , custom or native?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Writing to .fit files from a datafield app</title><link>https://forums.garmin.com/thread/951?ContentTypeID=1</link><pubDate>Thu, 15 Jan 2015 11:43:12 GMT</pubDate><guid isPermaLink="false">a9571b57-dd57-479e-8763-8f8a603e40aa:8cfe0159-baf7-40f5-b195-bb7f057845bc</guid><dc:creator>RPINA73</dc:creator><description>Yeah, but an app type application has to override a complete garmin app ;-). I just want the datafield to be able to write a record, hope garmin add this in the near future ;-). Regards,&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Writing to .fit files from a datafield app</title><link>https://forums.garmin.com/thread/920?ContentTypeID=1</link><pubDate>Wed, 14 Jan 2015 21:18:02 GMT</pubDate><guid isPermaLink="false">a9571b57-dd57-479e-8763-8f8a603e40aa:b2f39c6a-71bf-49e7-b8a2-620ebac6b06c</guid><dc:creator>hawken</dc:creator><description>There is an ActivityRecording API available to the App type application, which records data to FIT files. Data fields run in the context of another activity, so they don&amp;#39;t have the ability to record FIT files themselves--they just display information in new ways, though the activity in which the data field runs records as it normally would.&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>