Flore
Flore

Reputation: 191

Unable to get physical buttons info on wear OS 5.0 device

I'm trying to get info about the physical buttons on a wear OS device.

According to the official documentation, I should be able to get the button counts using WearableButtons.getButtonCount() but on the emulator and on a pixel watch 3, it always returns 0. Despite the fact the documentation clearly states that this method includes the power button, which is why 0 does not makes any sense as any device should at least have one power button

The documentation also states that from wearOS 3, two buttons are reserved for the OS, which happens to be the case on the pixel watch 3, which includes only two physicals buttons, both reserved for the OS so presumably not usable from an app.

So here is my question: Am I doing something wrong ? Or is the documentation is out of date and getButtonCount() now returns only the number of available buttons (excluding the OS buttons) ?

Also, since the documentation states that the OS reserved 2 buttons, I was about to give up using physical buttons on my app, but I noticed that the fitbit workout app is able to use the second physical button to pause/resume the workout, so there has to be a way to do it.

And even if we're not able to get the button press event (because it is reserved by the OS) I would still like to be able to get the button location information, to know where to crown is located, which varies between devices and the way the watch is worn. But WearableButtons.getButtonInfo() always return null

If anyone has been able to get physical buttons to work on wear OS 3+ any help would be appreciated.

Upvotes: 2

Views: 61

Answers (0)

Related Questions