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.
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));
}
}
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().
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...