Cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Watchface not updating until visible

ANSWERED

Has anyone else noticed that watchfaces doesn't update until they're actually visible on screen, i.e. after screen is activated? This is annoying because for a short moment the time from when I last looked at the watch is visible, and then it updates. 

 

I'm using clock.ontick and granularity minutes, but it's the same using seconds.

 

See this video for an example of it in action. The last time I looked on the watch was 08:03 and in the video you can see that time very briefly before it jumps to 08:07.

Best Answer
1 BEST ANSWER

Accepted Solutions

The Clock API is intended to minimize battery impact, so it's expected that things inside the tick event aren't running when the screen is inactive. That being said, there is a bug which is preventing the tick event firing when the screen wakes. This is most apparent when not using "seconds" granularity.

View best answer in original post

Best Answer
0 Votes
9 REPLIES 9

*Update*: I have the same problem, i didnt recognized it before.

 

Do you use the code from the example?

 

Like this:

// Update the clock every minute
clock.granularity = "seconds";

// Get a handle on the <text> element
let myLabel = document.getElementById("myLabel");

// Update the <text> element with the current time
function updateClock() {
let today = new Date();
let hours = today.getHours();
let mins = util.zeroPad(today.getMinutes());
let secs = util.zeroPad(today.getSeconds());

myLabel.innerText = `${hours}:${mins}:${secs}`;
}

// Update the clock every tick event
clock.ontick = () => updateClock();

// Don't start with a blank screen
updateClock();

Best Answer
0 Votes

The Clock API is intended to minimize battery impact, so it's expected that things inside the tick event aren't running when the screen is inactive. That being said, there is a bug which is preventing the tick event firing when the screen wakes. This is most apparent when not using "seconds" granularity.

Best Answer
0 Votes

Yeah, I used that code and modified it to update graphics instead of texts. Good to hear it wasn't just me.

Thanks Jon, for the explanation, let's hope the bug get squashed soon.

Best Answer
0 Votes

@JonFitbit wrote:

The Clock API is intended to minimize battery impact, so it's expected that things inside the tick event aren't running when the screen is inactive. That being said, there is a bug which is preventing the tick event firing when the screen wakes. This is most apparent when not using "seconds" granularity.


Actually, I tried your solution in sdk-lcd-clock and it seems to keep the time display little more updated. But perhaps not as battery efficient as the Clock API then?

Best Answer
0 Votes

I understand that logic, but is there a way to force some thing to run? I am trying to have the Haptic fire off at a specific time, but it only fires if the screen is active, otherwise it skips it.

 

For example, could you set a Haptic response to fire at the top of every hour?

Best Answer

I have the same issue / want the same desired outcome as you... Did you ever find a solution to this?

Best Answer
0 Votes

@drb116 wrote:

I understand that logic, but is there a way to force some thing to run? I am trying to have the Haptic fire off at a specific time, but it only fires if the screen is active, otherwise it skips it.

 

For example, could you set a Haptic response to fire at the top of every hour?


You can use your own timer through setInterval.  

Best Answer
0 Votes

I use this in the app index, seems to keep the clock updating for me

 

setInterval(updateClock, 1000);

Best Answer
0 Votes

Couldn't you just access the javascript Date() as soon as the screen comes on? Executing code while the screen is off will drain the battery faster.

Peter McLennan
Gondwana Software
Best Answer
0 Votes