I am trying to display the calories burned during the current activity in my watch app (its a full fledged app, not a WF). I am able to get heart rate, session timer time, and other fields just fine and display them, however calories is always 0 for some reason ( I am playing back fit files in the simulator that i downloaded from my own garmin connect activities page)
I am starting a session like so:
session = ActivityRecording.createSession({:name=>"Surfing", :sport=>Activity.SPORT_SURFING}); session.start();
My function that gets the calories is below:
public function getActivityCalories() as Lang.Number? {
if (self.session != null) {
var info = Activity.getActivityInfo();
if (info != null) {
return info.calories;
}
}
System.println("Returning null calories");
return null;
}
In my view I call that function:
var activityCalories = getActivityCalories();
var calories = "0";
if (activityCalories != null) {
System.println("activity calories: " + activityCalories.format("%d"));
calories = activityCalories.format("%d");
}
caloriesLabel.setText(calories);
the println is always printing activity calories: 0
its not null, its 0 since the println is inside the null guard if statement.
This is the exact same way I get heartrate and other activity data, so i am not sure where I am going wrong (or if its a simulator issue)