
Hello,
guys anyone know how to make the onUpdate() event run every second??
I try to create my own watch face for vivoactive 3 and i create getHeartRate() function and its work very well when i look at the screen and the screen light turn on and when its off
the heart rate text is stack on the last heart rate,
this is the code:
function getHeartRate(){
var heartRateText = "";
var currentHeartRate = Activity.getActivityInfo().currentHeartRate;
if(currentHeartRate != null){
heartRateText = currentHeartRate.toString();
}else{
var heartRateHistory = ActivityMonitor.getHeartRateHistory(1, true);
var heartRateSample = heartRateHistory.next();
var heartRate = heartRateSample.heartRate;
if(heartRateSample == ActivityMonitor.INVALID_HR_SAMPLE){
heartRateText = "";
}else{
heartRateText = heartRate;
}
}
var heartRateDisplay = View.findDrawableById("HeartRateDisplay");
heartRateDisplay.setText(heartRateText.toString());
}
and i call this event in my onUpdate() event.
Ty
