Need help with getting Active Minutes for the Day

I would like to be able to get Active minutes for the day .. as defined in :
Toybox::ActivityMonitor::ActiveMinutes

There is Moderate, Total and Vigorous .. under instance attribute summary.

Right now .. I get in the simulator "Moderate Class" on the screen and not a number as desired, and I get the same on my VAHR.
  • Are you sure it's a string when you display it? Something like:

    activityMonInfo.activeMinutesDay.moderate.toString()

    It works fine for me.
  • What is the difference between ..

    Class: Toybox::ActivityMonitor::ActiveMinutes

    and what you have

    Class: Toybox::ActivityMonitor::Info


    There is no activeminutesday in the first one ?

    I tried .. but as you know, I do not know anything about classes,methods etc.
    It is a wonder that I managed to do anything .. smiles.

    using Toybox.ActivityMonitor as ActMon;

    var actMinModerate = ActMon.Info.activeMinutesDay.moderate;
    dc.drawText(5 ,140,Gfx.FONT_LARGE ,actMinModerate.toString(), Gfx.TEXT_JUSTIFY_LEFT);

    I get the following ..

    Device id 1 name "A garmin device"
    Shell Version 0.1.0
    Failed invoking <symbol>
    UnexpectedTypeException: Expected Method, given Class definition
  • actMinModerate isn't a string.

    actMinModerate.toString() should work for you. You might also try actMinModerate.toNumber()

    Update after your update.

    ActMon.Info.activeMinutesDay.moderate;

    should be:

    ActMon.getInfo().activeMinutesDay.moderate;

    Or, with the line I posted before:

    using Toybox.ActivityMonitor as ActMon;
    .
    .
    .

    var activityMonInfo=ActMon.getInfo();
    activityMonInfo.activeMinutesDay.moderate.toString()
  • Ok .. works now. Thank you.

    And wow, my simulator even works. The planets have aligned.