getActivityInfo Unexpected Behavior and Inconsistent Behavior across devices

I'm using getActivityInfo() as a way to indicate if sensors are detected prior to starting recording an activity.

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.
  • Hi Roger,

    I've been attempting to replicate this, and so far, I haven't had much luck. I'd like to see if you could outline an explicit set of steps to follow on a device (let's use vivoactive to start) that I could try to reproduce the issue.

    I've been testing with a stripped down version of the Sensor sample app that only reports cadence, loading it onto a vivoactive, and then using an ANT+ sensor sim to control the reported cadence. If I understand correctly, I need to pair with my sensor, start a running activity, stop the running activity, and then launch my Sensor app and start a new recording. This should cause a the cadence to return null until I start a new running activity, correct?

    I feel like I'm missing something, so if there's any additional info you can provide that might help, I'd appreciate it.

    Thanks!
  • After you exit the running activity, and start the sensor app, don't immediately start the recording and watch the cycling cadence field. Roger indicates that you'll see cadence values when you should not.

    Travis