I will try to capture remote control keys on app on android TV, I implemented keydown method like this:
public boolean onKeyDown(int keyCode, KeyEvent event){
if(keyCode == 10010){
Toast.makeText(this, "Button X pressed", Toast.LENGTH_SHORT).show();
pulsarBotonTV();
return true;
}
//....
else{
Toast.makeText(this, "ANOTHER KEY"+keyCode, Toast.LENGTH_SHORT).show();
Log.w("app", "Keycode else: " + keyCode);
return super.onKeyDown(keyCode, event);
}
}
I can capture the most keys but, I can´t capture shortcut keys. TV, FILE,WEB,SET ( image:[image of shortcuts keys][1] )
So, on standard key press on remote control, I can capture key and see on logcat:
D/WindowManager(1943): mBootFastRuning = false shutdhownPending = false
D/InputManager-JNI(1943): handleInterceptActions: POLICY_FLAG_PASS_TO_USER.
D/WindowManager(1943): isFactoryConfigExist retval = false
D/WindowManager(1943): keycode is 8 , and POWER is 26
D/LatinIME(2370): key event KEYCODE_1
W/app(25843): Keycode por else: 8
D/WindowManager(1943): mBootFastRuning = false shutdhownPending = false
D/InputManager-JNI(1943): handleInterceptActions: POLICY_FLAG_PASS_TO_USER.
D/WindowManager(1943): isFactoryConfigExist retval = false
D/WindowManager(1943): keycode is 8 , and POWER is 26
W/app(25843): Keycode por else: 8
but when press shortcut keys no keydown method is called, I can see on logcat:
D/WindowManager(1943): mBootFastRuning = false shutdhownPending = false
D/InputManager-JNI(1943): handleInterceptActions: POLICY_FLAG_PASS_TO_USER.
D/WindowManager(1943): isFactoryConfigExist retval = false
V/WindowManager(1943): it's key 186 and down = true
D/WindowManager(1943): keycode is 186 , and POWER is 26
D/WindowManager(1943): mBootFastRuning = false shutdhownPending = false
D/InputManager-JNI(1943): handleInterceptActions: POLICY_FLAG_PASS_TO_USER.
D/WindowManager(1943): isFactoryConfigExist retval = false
V/WindowManager(1943): it's key 186 and down = false
D/WindowManager(1943): shortcut path is app--split--com.google.android.youtube--split--com.google.android.youtube.app.honeycomb.Shell$HomeActivity W/ContextImpl(1943): Calling a method in the system process without a qualified user: ....
Any ideas how I can listen this shortcut key press??