I've been trying to make a watchface for the Instinct Crossover. The problem is that I cannot get the hands to move properly on the device, although everything works ok on the simulator. More precisely, the call to setClockHandPosition
always fails on the device with "Exception: Invalid state for the clock provided", no matter what AnalogClockState
value I set for clockState
. Please note that all clockState
values (resting, holding, system time) are accepted and work properly on the simulator.
For reference, here's the code in onUpdate
:
function onUpdate(dc as Dc) as Void {
var clockTime = System.getClockTime();
var timeString = Lang.format("$1$:$2$", [clockTime.hour, clockTime.min.format("%02d")]);
var view = View.findDrawableById("TimeLabel") as Text;
view.setText(timeString);
View.onUpdate(dc);
try {
var dict = {:clockState=>ANALOG_CLOCK_STATE_SYSTEM_TIME};
setClockHandPosition(dict);
} catch (ex instanceof Lang.Exception) {
System.println("exception thrown " + ex.getErrorMessage());
ex.printStackTrace();
}
}