Changing the location of the battery icon on a custom Android wear watch face

android, clock, wear-os

Solution

For new Watch Face API you should call `setWatchFaceStyle` somewhere in your code. `Engine.onCreate()` is a good place. This is how your call look like:

setWatchFaceStyle(new WatchFaceStyle.Builder(MyWatchFaceService.this)
        .setCardPeekMode(WatchFaceStyle.PEEK_MODE_SHORT)
        .setBackgroundVisibility(WatchFaceStyle.BACKGROUND_VISIBILITY_INTERRUPTIVE)
        .setHotwordIndicatorGravity(Gravity.TOP | Gravity.CENTER_HORIZONTAL)
        .setShowSystemUiTime(false)
        .build());

This will put the "Ok Google" hotword at the top in the middle of the screen.

Similarly, you can do this for status icons with `setStatusBarGravity()`:

        .setStatusBarGravity(Gravity.TOP | Gravity.CENTER_HORIZONTAL)

Problem

I'm creating a custom watch face and I would like to change the location of the battery icon on it. By default it is placed on the top left corner and I would like it to be positioned somewhere else on the taskbar. Does anyone know how it can be done?

Original source