-
• #2
Would you be wearing the Bangle while sleeping?
I'd say probably the best bet is to create a 'myapp.boot.js' file that does something like:
Bangle.on('health', function(e) { if ((new Date()).getMinutes()!=0) return; // not every hour // could check e.steps here? if (e.movement > 1000) load("myapp.app.js"); });
The 'health' event is fired every 10 minutes with the last 10 mins data, and 'movement' is a value that shows how much the device was moved around during that 10 minutes. You could also check
steps
, and maybe even Bangle.isCharging() ?The other thing you could do is check if 'quiet mode' is on (but that's just based on time of day)
There is a library for wear detection (https://github.com/espruino/BangleApps/blob/master/modules/wear_detect.js) but honestly it's got some issues. I guess you could do something similar for sleep detection and then at least over time users might contribute some changes that make it a bit more accurate.
I'm writing a "breath" app. I find out after writing it that there was already one in the apps repository, but my app fits better my needs so i'll finish it and publish it when ready.
But i'm facing an issue that i don't know yet how to solve it:
sched
library provides an api to set alarms, and the alarm object can ship ajs
field that contains a js oneliner that can be used to execute an app.What would be the most optimal way to do this?