Many watchfaces have a switch to enable/disable the seconds indicator. To preserve battery, I usually leave it disabled. However, sometimes I want to know seconds as well.
On my previous smartwatches (with Wear OS, aka Android Wear), there was “ambient mode” and active. Active mode was when the watchface was in full color and showing seconds, while “ambient mode” was when the watchface was dimmed and preserving power.
On my Pebble, there is something similar with the backlight. If I as a developer could be notified when the backlight was enabled, I would be able to show seconds only when the backlight was active, and go back to show only minutes when the backlight is turned back off again.
if (light_is_on()) {
// The backlight is currently lit
}
Is there any way to subscribe to these events? I guess that buttons could be intercepted to do something similar, but I would like to be able to use the wrist-flick as well.
It is possible to implement this functionality in apps/watchfaces right now (except watchfaces can’t listen for any buttons); I’ve done it in Instant Timer.
But to do so I had to delve into the PebbleOS code to see how the system backlight is implemented, then reimplement it myself. Its just a few service subscriptions and a timeout, so not the hardest thing in the world but definitely harder than it should be.
I had done a bit on WearOS before as well, so I was also surprised the “ambient mode” concept was missing here, which would make it a whole lot easier.
To clarify: the backlight more-or-less turns on upon: any button press (window_single_click_subscribe) ((actually probably any button-down event, but close enough)), shake (accel_tap_service_subscribe) or plugged/unplugged from charger (battery_state_handler, charge.is_plugged), and then it fades out over 500ms, 3000ms later. I think the latest PebbleOS also made it turn on whenever the screen is touched too.
Ideally any “ambient mode” service should probably be separate from the backlight (and the backlight triggers from ambient mode) so that apps can use it even if the user has set the system backlight setting to just be always-on or always-off.