Watchface with Seconds

Is it possible to create a watchface that contains seconds. According to the programmers guide, onUpdate is only called once every minute for watchfaces and its not possible to create a timer in a watchface.
  • On a real device, the watchface is in low power mode most of the time - one minute updates. When you raise your wrist to look at it, it switches out of low power mode for just a few seconds (one second updates), then goes back to low power mode.

    This is all to save battery life - if you're not looking at it, no need to update every second.

    Some faces hide the seconds when in low power mode, as they wont be changing anyway.

    You might be able to create your own timer so it will update every second, but then you have to deal with a much larger drain on the battery, and you'd only be updating the face when no one is looking at it. What I do is set/clear a flag (and then call requestUpdate()) in the onEnterSleep() (low power) and onExitSleep() (leave low power), and then in onUpdate, I check that flag to see if seconds should be displayed. Doing the requestUpdate() in these calls give you a display update as soon as the modes change.
    function onExitSleep() {
    inLowPower=false;
    Ui.requestUpdate();
    }

    function onEnterSleep() {
    inLowPower=true;
    Ui.requestUpdate();
    }
  • You might be able to create your own timer so it will update every second, but then you have to deal with a much larger drain on the battery, and you'd only be updating the face when no one is looking at it.


    Technically you can cause the watch to call onUpdate() every second (actually more like every 100milliseconds) permanently by nesting a UI.Animation() call inside the final callback of the UI.Animation()*. All you technically need is an initialized Drawable object; you don't even have to actually draw the drawable in our onUpdate().

    Something like this:
    class Animatable extends Ui.Drawable
    {
    function initialize(params) {
    locX = params.get(:locX);
    if (radius == null) {
    locX = 1;
    }
    }
    }

    class FaceItView extends Ui.WatchFace {
    var drawable;
    function onLayout(dc) {
    drawable = new Animatable({});
    animationDone();
    }
    function onUpdate(dc) {
    dc.setColor(Gfx.COLOR_BLACK, Gfx.COLOR_TRANSPARENT);
    dc.clear();
    var clockTime = Sys.getClockTime();
    dc.setColor(Gfx.COLOR_WHITE, Gfx.COLOR_TRANSPARENT);
    dc.drawText(screenWidth/2, screenHeight/2, Gfx.FONT_LARGE, Lang.format("$1$:$2$:$3$",[clockTime.hour.toString(), clockTime.min.format("%02d"), clockTime.sec.format("%02d")])
    , Gfx.TEXT_JUSTIFY_CENTER | Gfx.TEXT_JUSTIFY_VCENTER);
    }
    function animationDone(){
    Ui.animate(myDrawable, :locX, Ui.ANIM_TYPE_LINEAR, 0, 1, 1.0, method(:animationDone));
    }
    }


    However, you will only get about half a day to 1 day max of battery life if you decide to do that kind of insanity. And if you upload one that does this to the Garmin Connect App store, please put in the info that you've done this, or everyone will hate you for killing their watch battery.
    *

    *turns out this won't prevent the watch from going into 1minute update intervals after the onEnterSleep is called, so nevermind.
  • Technically you can cause the watch to call onUpdate() every second (actually more like every 100milliseconds) permanently by nesting a UI.Animation() call inside the final callback of the UI.Animation().

    I am under the impression that user timers and animations are supposed to be disabled after the call to onEnterSleep() is made. If this is correct, then it seems like an application that does this could be broken when the bug is fixed.
  • TRAVIS - yeah you are correct, I just tested the old watchface I had made that nested animations like that, and it will stop the animating after onEnterSleep() is called... now I wonder if I actually did get it to permanently loop at all before, or just thought I had because of the simulator not quite matching the real thing. Or maybe I did it on a prior firmware.

    Either way, that doesn't work!
  • Former Member
    Former Member over 10 years ago
    The OS kills all timers when entering low power mode.
  • Former Member
    Former Member over 10 years ago
    OK, thank you for all you answer ! I understand it is not available right now !
    It's still not explain how the creator of the Big Time watchface does to update the minutes at the second :00s even if the vivoactive is in low power mode... So I am sure it is possible to do it !
  • It could be he just forces the seconds to be ":00" in low power mode, so it displays "nice".
  • Former Member
    Former Member over 10 years ago
    No because even if you enter in low power mode at :50s, the refresh is done 10s later to display the right hour ! And he get the time from Sys.getClockTime(); because the watch is taking the time from the phone.

    Maybe it is the simulator who is not updated ! and maybe they implement on the vivoactive a refresh every minutes, but at the :00s time, so the 1minute timer is not starting when we enter to the low power mode, but when the clock change the minute ???
    so if this is true, this could be the answer to my question about the refresh of the watchface...

    But it still don't give me a clue to update every second....

    And i Try the animate code given above, but when i enter to the sleep mode, on the simulator, the refreshed is stopped...
  • If you really want something that will update every second, do it as a watch-app and not a watchface.

    Like I said, in "big time" it could just be that someone complained about seconds being wrong, and the developer just forced the display of "00" in low power mode.

    For mine, I just don't display seconds in low power mode at all.

    You are probably seeing the presentation, and not what's really happening in the code.
  • But it still don't give me a clue to update every second.... And i Try the animate code given above, but when i enter to the sleep mode, on the simulator, the refreshed is stopped...


    ConnectIQ is supposed to prevent you from doing this. Even if you are able to implement a watch face that does it, you're just going to eat up the battery and nobody will use your watch face.

    Travis