0

I am trying to develop a launcher TV app in android Java. I want the launcher app to show my own custom setting class when settings button is clicked from Dpad. for now when i click the settings button from dpad android system settings is triggered and displayed.

I think this can be achieved because in all the launcher of app of Android Television APP when the settings button is clicked from Dpad their custom setting class is opened rather than system settings.

Can anyone help me how can i acheive that ?

1 Answers1

0

Have you tried overriding onKeyDown? if not. you can start there.

//Handling remote control actions
    @Override
    public boolean onKeyDown(int keyCode, KeyEvent event) {
      
        if(keyCode == KEYCODE_SETTINGS){// from developers page
           // your coder here
           // and return true if you don't want system settings to be launched
           return true;
          }
    }

But as I found out on my TV. some keys don't invoke KeyEvent. instead (in mine it was the volume keys) broadcast an action. if that is the case, you have to use broadcastReceiver and get the action from there.

for KeyEvents I ended up having a class that implements KeyEvent.Callback{}

TG. Kahsay
  • 114
  • 5
  • Here setting key donot invoke key down event … unlike all other keys do.. for broadcast also no system broadcast is being triggered on key press of settings key .. as I have to handle the Key event also from back ground.. can you elaborate in keyEvent.Callback{} – Janam Maharjan Feb 13 '23 at 20:18
  • if Setting key isn't invoking keyDown event then `KeyEvent.CallBack{}` will also not help. because it handles KeyEvents. I meant I used a separate class for handling KeyEvents like this – TG. Kahsay Feb 13 '23 at 21:24
  • according to [this](https://developer.android.com/reference/android/view/KeyEvent#KEYCODE_SETTINGS) there is a KeyEvent for Settings, Sorry I cant be much help appart from this. – TG. Kahsay Feb 13 '23 at 21:49