var info = Act.getActivityInfo();
if (info != null) {
if (info.timerTime != null) {
var tt = info.timerTime / 1000;
var hh = tt / 3600;
var mm = tt / 60 % 60;
var ss = tt % 60;
var text;
if (hh != 0) {
text = Lang.format("$1$:$2$:$3$", [
hh,
mm.format("%02d"),
ss.format("%02d")
]);
}
else {
text = Lang.format("$1$:$2$", [
mm,
ss.format("%02d")
]);
}
mTime_value.setText(text);
}
mHRM_indicator.setFill(info.currentHeartRate != null);
mSPD_indicator.setFill(info.currentCadence != null);
if (info.currentCadence != null)
{
Sys.println(info.currentCadence);
}
mPWR_indicator.setFill(info.currentPower != null);
}
else {
mHRM_indicator.setFill(false);
mSPD_indicator.setFill(false);
mPWR_indicator.setFill(false);
}
(This is a bit complicated so I will use the word "execute" to mean the operation of a function on the watch and "run" to mean the type of activity that's faster than walking)
If the last activity that was executed was a running activity (either a native running activity or a running activity that was executed in ConnectIQ), some watches will continue to return a value for info.currentCadence after the running activity is exited. So if I execute a running activity and exit that activity and then execute my cycling app in ConnectIQ, it will indicate that a Speed and Cadence sensor is present even if there isn't one before the activity recording is started. As soon as activity recording is started, info.currentCadence starts returning null and keeps returning null until another running activity is executed.
The Fenix3 and the VivoActive continue to return a value after the running activity is exited. The 920XT appears to return a null after the running activity is exited. I'm not sure if this could be replicated in a meaningful way on the simulator.
I am assuming that this has something to do with the fact that info.currentCadence returns the running cadence from the accelerometer or footpod in a running activity but returns the cadence from a speed and cadence sensor in a cycling activity.
I would prefer the 920XT behavior, but anything that's consistent across platforms would be easier to deal with.