How to get current Hearth Rate on Watch Faces?

Former Member
Former Member
I developed a quick Watch Face and want to display the current Hearth Rate exactly same way as Hearth Rate widget.

I used this code to achieve that:

var HRH=Act.getHeartRateHistory(1, true);
var HRS=HRH.next();
var HRSnow=HRS.heartRate;

if(HRSnow!= Act.INVALID_HR_SAMPLE){
heartRateText = HRSnow;
}

The problem with this is that it refreshes (only) each minute, so it's not accurate at all. Is there a way to get last Hearth Rate calculated by device and get it refreshed every second?

  • Former Member
    Former Member over 7 years ago
    It is working now, thanks a lot!!

    P. S.
    I've corrected my previous post - include Jim's correction
  • It is strange, that autocomplete feature does not work with "Activity.getActivityInfo().currentHearRate;". I see only Activity.getApp(). Ok, my be it is a bug. Sure, I know about simulating data in the simulator, but thanks for reminder.


    I'm glad you were able to get everything working! Regarding the report about autocomplete above, we have a ticket created to address this issue. Thanks so much!

    - Coleman
  • I am beginning to code with ConnectIQ 4.5.x, and I notice that instead of "Act" e.g. in

    var HRH=Act.getHeartRateHistory(1, true);

    I have to write "ActivityMonitor" like

    var HRH=ActivityMonitor.getHeartRateHistory(1, true);

  • actually, the code was assuming

    using Toybox.ActivityMonitor as Act;