Need help to catch Volume Up/Down key events


I’m trying to receive the volume key up/down events into my application on my nvidia shield android tv box.
I have tried to use onKeyDown and dispatchKeyEvent.
I can receive other keys but no volume up/down keys.

Any idea ?


I asked one of the engineers about this, and here is the response.

This might help:
It could manifest as either a Key* Event (digital) or as a Motion* Event (analog) - so, it depends on the device being used. The getevent cmdline utility can help uncover the event type.