androidwear-osandroid-wear-notification

Wearable Notification that is updated frequently causes flicker


On a wearable my app displays a rest timer as shown in the picture. It simply counts down and is updated each second.

My problem is that since it is updated each second, it creates a flickering effect.

Ive tried updating it each 5 seconds or so but it unfortunately ruins the whole thing and makes it very unintuitive. Its my best option at the moment though.

Is it possible to update the notification each second without causing the flicker?

Wearable app


Solution

  • If you want to show a notification with a timer, either counting up or down, that's a built-in feature for that. Here's some code I wrote that puts it all together for Android Wear:

    https://github.com/danwallach/XStopwatch/blob/master/wear/src/main/java/org/dwallach/xstopwatch/NotificationHelper.java

    Notably, you'll want your notification builder to do something like this: builder.addAction(android.R.drawable.ic_media_pause, "", clickPendingIntent) .setWhen(eventTime) .setUsesChronometer(true) .setShowWhen(true);