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.
Espruino is a JavaScript interpreter for low-power Microcontrollers. This site is both a support community for Espruino and a place to share what you are working on.
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:
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.