Hi there :)
I'm new on the FIT Sdk (downloaded this morning). I can decode my FIT file with C# without problem. But I would like to know the type of my activity. May be you can help me to do it ?
Thx !!
Hi there :)
I'm new on the FIT Sdk (downloaded this morning). I can decode my FIT file with C# without problem. But I would like to know the type of my activity. May be you can help me to do it ?
Thx !!
If I understand your question, the key is to thoroughly understand the FIT Protocol and the Global Profile (see Profile.xlsx in the SDK). Activities can have a type (field #2), but don't always. Activities often have one or more sessions, and a session can have a `sport` and `sub_sport` which may contain the information you're really after.
The sport type of the activity is found in the Session message Sport and Sub-Sport fields. There may be multiple sessions in a single Activity File, each having their own sport type (as is the case with a brick workout or multi-sport activity), which is the reason that this information is in the Session messages and not the Activity message.
There are examples of using these fields in the Decoding Activity Files recipe.
https://developer.garmin.com/fit/cookbook/decoding-activity-files/
Thank you for your answer, it's good 
Do you know how I can get the value of the sport? I found in Debug the value and the associated sport in the Profile.xls file, however, I can't get the value directly in the code.
HHere is my code : SessionMesg mySessionMessage = (SessionMesg)e.mesg;
foreach (var Field in mySessionMessage.Fields)
{
if(Field.Name.Contains("Sport"))
{
Console.Write("Ok");
}
}
Sorry if my way is not the best I am recreational. Maybe you have improvements?
mySessionMessage.GetSport() and mySessionMessage.GetSubSport() will give you what you are looking for. Both methods return a nullable value, so you do not need to check that the field exists before calling the methods. Instead you can check the return value.
There are examples of using these methods here.
https://developer.garmin.com/fit/cookbook/decoding-activity-files/