Button Mappings
The Almer Arc has 4 buttons. A power button located on the left side of the device and three action buttons located on the right side of the device. From a mobile application perspective the physical buttons are mapped to the Android KeyEvent keycodes like so:
- Front button →
KeyEvent.KEYCODE_DPAD_LEFT
- Middle button →
KeyEvent.KEYCODE_BUTTON_SELECT
- Back button →
KeyEvent.KEYCODE_DPAD_RIGHT
- Power button →
KeyEvent.KEYCODE_POWER
Example
Here is a simple example to get you started:
- java
- kotlin
public boolean onKeyDown(int keyCode, KeyEvent event) {
if (event.getKeyCode() == KeyEvent.KEYCODE_BUTTON_SELECT) {
// do what you want with the button
return true;
}
return super.onKeyDown(keyCode, event);
}
override fun onKeyDown(keyCode: Int, event: KeyEvent): Boolean {
if (event.keyCode == KeyEvent.KEYCODE_BUTTON_SELECT) {
// do what you want with the button
return true
}
return super.onKeyDown(keyCode, event)
}