Hello,
I would like to test vibration alarms with the Connect IQ device simulator. In settings menu, vibration is active.
How does it work or signalize an vibration alarm?
Thanks
Hello,
I would like to test vibration alarms with the Connect IQ device simulator. In settings menu, vibration is active.
How does it work or signalize an vibration alarm?
Thanks
You have code in your app that uses "Attention". You set up a vibe profile and then run it:
var vibp=[ new Attention.VibeProfile(100, 800 )];
Attention.vibrate(vibp);
What happens is the simulator "shakes".
Great! Thanks! if I have it included in onUpdate() it shakes only once at the first appearance of the simulator, doesn't it have to cycle or update each 5 seconds and vibrate accordingly?
How often is onUpdate being called? You can't use this in a WF, so it's got to be a widget or device app, and there you control when onUpdate is called.
and how is this handled in the simulator environment? How often is onUpdate being called?
For a widget or device app, with no calls to WatchUi.requestUpdate(), onUpdate is called once.
It's not like a watch face where onUpdate is called on a regular basis.
How to vibrate n- times in a row?
A common way to do this in a widget or device app is to use a time:
Create the timer and start it in initialize (this is a 1 second timer)
var timer= new Timer.Timer();
timer.start( method(:onTimer), 1000, true );
With onTimer being:
function onTimer() { WatchUi.requestUpdate();}
Look at VibeProfile, where the profile itself might do it.
Ir using a timer as I posted elsewhere. (do it the next 10 times onUpdate is called()?)
I use Time.now().value(); and calculate a difference between initial (onStart) and actual (onUpdate), which works fine as debugging values show
I also call Toybox.Attention, but no reaction on my Venue SQ, what's wrong?
var vibp1=[ new Attention.VibeProfile(50, 1000)];
var vibp2=
[ new Attention.VibeProfile(50, 1000),
new Attention.VibeProfile(0, 1000),
new Attention.VibeProfile(100, 1000),
];
if (diffsec == 60) {
Attention.vibrate(vibp1);
}
if (diffsec == 120) {
Attention.vibrate(vibp2);
}
Could it relate to the onUpdate frequency?... e.g. Update Is on second 80, 140,200, which in this case would not trigger a vibration if e.g. second 120 is not caught
As I've said the easiest way to regularly get onUpdate() called is to start a timer.
At the beginning of your onUpdate function add
System.println("onUpdate called");
You'll see a line in the console each time onUpdate is called.