10-05-2017 10:38
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post

10-05-2017 10:38
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post
- Who Voted for this post?
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.
Answered! Go to the Best Answer.
Accepted Solutions
10-05-2017 13:28
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post


10-05-2017 13:28
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post
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.

10-05-2017 12:00 - edited 10-05-2017 12:07
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post

SunsetRunner
10-05-2017 12:00 - edited 10-05-2017 12:07
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post
*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();

10-05-2017 13:28
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post


10-05-2017 13:28
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post
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.

10-06-2017 02:08
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post

10-06-2017 02:08
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post
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.

10-06-2017 04:19
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post

10-06-2017 04:19
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post
@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?

10-06-2017 09:06
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post

10-06-2017 09:06
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post
- Who Voted for this post?
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?
12-24-2017 17:50
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post

12-24-2017 17:50
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post
I have the same issue / want the same desired outcome as you... Did you ever find a solution to this?

12-25-2017 11:52
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post

12-25-2017 11:52
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post
@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.

12-31-2017 14:57
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post

12-31-2017 14:57
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post
I use this in the app index, seems to keep the clock updating for me
setInterval(updateClock, 1000);

12-31-2017 15:14
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post


12-31-2017 15:14
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post
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.
Gondwana Software

