I’m trying to get the media keycode events in android. aka KEYCODE_MEDIA_PLAY_PAUSE (keycode 85). But these are not defined in unitys keycode enum. Below are the things I’ve tried that failed. Does anyone have any other ideas?
-
Can’t add to, or overide KeyCode enum such that the following would work. And can’t change or override Input.GetKeyDown.
if (Input.GetKeyDown((KeyCode)85)) { Debug.Log("KEYCODE_MEDIA_PLAY_PAUSE :85"); }
-
Created an android plugin that uses onKeyDown to store keyevents. The problem here is onKeyDown is implemented in View or Activity both of which are not running in a compiled library.
Below is the onKeyDown function…@Override
public boolean onKeyDown(int keyCode, KeyEvent event) {
Log.d(“KeyboardTest”, "onKeyDown: " + keyCode + " , " + event);
LastKeyPressed = KeyEvent.keyCodeToString(keyCode) + “”;
return super.onKeyDown(keyCode, event);
}