Edit onEnterSleep() delay

Hi,

Is it possible to edit the delay after which onEnterSleep() is called?

My watchface is animated and is interrupted by the onEnterSleep() method.

Also, bonus question: why is the exact delay after which onEnterSleep() is called never mentioned in the docs? Per the documentation: After this period in high power mode (typically about ten seconds), the system will call onEnterSleep() to notify the application that it is preparing to enter low power mode.

Thanks!

Pierre

Top Replies

All Replies

  • Is it possible to edit the delay after which onEnterSleep() is called?

    I'm fairly certain that the timeout is pre-configured for all devices and cannot be changed. I made a change to the simulator recently that will prevent onEnterSleep from being called automatically, but it sounds like you are more concerned with the behavior on device at this point.

    why is the exact delay after which onEnterSleep() is called never mentioned in the docs?

    Because the exact delay is determined by the device and is outside of the control of the ConnectIQ virtual machine. The device firmware could be configured to associate the backlight timeout with the delay time, or it could use 11 seconds to be different.

  • No way to change it, but it is about 10 seconds on all devices I've used.

    The simple answer why it's so short - it's all about the battery.  It's so a watch face can do things like display the seconds after a gesture.  On most newer devices, there is "onPartialUpdate", where things like seconds can be updated all the time, but that's quite restricted in what can be done every second.  On devices like the venu, things are even a bit different, in that when in low power mode there are restrictions to prevent burn-in and allow "always on"

    As far as why the sim doesn't change automatically, that would kind of be a pain while developing I think.  But it's not the only case where the sim doesn't act like real devices.  Another is widgets.  There, on watches, there's a timeout that can range from about 30 seconds to two minutes, where on a real device, the widget terminates and the user is returned to the watch face, but in the sim, a widget can run forever.

  • Thanks for the replies, I guess part of the fun in programming on smart watches is to deal with these restrictions!

  • The day I pre-ordered the original va, I started on a widget, and it wasn't until I actually got the va did I understand the widget timeout part.  It was probably some place in the doc for the va itself, but didn't know it until I saw it myself.