Announcement

Collapse
No announcement yet.

Announcement

Collapse
No announcement yet.

Capture volume key events in Android TV Box from Android version 8.1 on wards

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Capture volume key events in Android TV Box from Android version 8.1 on wards

    We have Android TV (ATV) box running on Android version 8.1 and above. We need to get key events for volume keys when pressed from ATV remote. Unfortunately we couldn't get volume key events from Android version 8.1. But we can get volume key events from Android version Nougat 7.0 box.

    Question : How I need to capture volume key events in Android TV box versions 8.1 and 9 [pie] ?

    We have tried following callback API : onKeyDown(), onKeyUp(), dispatchKeyEvent(), onKeyLongPress() and onKeyEvent() in activity class.

    Code :
    override
    public boolean onKeyDown(int keyCode, KeyEvent event){
    Log.d(TAG,"Key code pressed:" + event.getKeycode);
    }

    Actual output : onkeydown not get triggered for volume keys

    Expected output : Key code pressed :25 Key code pressed: 24

    Image : Remote used for capturing key events

    Remote
    Attached Files
    Last edited by MSPL Dev; 07-10-2019, 06:30.
Working...
X