Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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?

like image 276
Zlatko Avatar asked Dec 26 '22 06:12

Zlatko


2 Answers

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)
like image 166
gruszczy Avatar answered Feb 01 '23 12:02

gruszczy


UPDATE: See the accepted answer, this is now possible.

Currently this is not possible, although it appears some google developers have hinted that this will be added in the future.

https://plus.google.com/+EricaJoy/posts/76W1HUsrRcw

As to why it's not possible:

Unfortunately, the API to actually configure how your watchface should interact with the rest of the system isn't public. To use it, you need to sign your APK with either the system certificate, or with the same certificate as the launcher (package:com.google.android.wearable.app) on your device.

(source)

Also, to anyone else looking for it, this same issue applies to card peek height, and a boatload of other options for homescreen watch faces. Not just the battery icon.

like image 23
sebirdman Avatar answered Feb 01 '23 12:02

sebirdman