Remote Control Input (Fire TV)
All buttons, Android events, and behavior guidelines are the same for all remotes — with the exception of the voice search (microphone) button, which is only available on some remotes.
For suggested guidelines on button behavior for all supported controllers, see Controller Behavior Guidelines. For information on handling input from the Amazon Fire Game Controller, see Amazon Fire Game Controller Input.
Controllers Overview
The Amazon Fire TV platform supports user input from the Amazon Fire TV Remote, the Fire TV Voice Remote, the Fire game controller, and other game controllers that support the Bluetooth HID gamepad profile. All controllers must be paired with the device to be used.
All the Amazon Fire TV controllers are Android input devices. You use the same techniques and APIs to manage input from those devices as you would any other Android input device.
In particular, simple input from any controller such as navigation or selection can be managed through key events in the same way you would handle input from a keyboard or a button pad.
Buttons
Most Amazon Fire TV remote controls have these buttons. Some Fire TV remotes do not include the microphone (voice search) button.
Some remote controllers have additional buttons — such as volume up/down, power, Netflix, Amazon Prime, and other apps. However, these buttons can't be mapped to events in third-party apps.
Capturing Input
All Amazon Fire TV remote controls generate KeyEvent
events for button presses, as any Android input device does. You can handle controller button input with standard Android event listener interfaces and callbacks (onClick()
, onFocusChange()
, and so on). Neither the Amazon Fire TV Remote nor the Voice Remote raises motion events (from the Android MotionEvent
class).
To capture specific button press events in your View
, override input event handlers such as onKeyDown()
. Test for the input constants from the KeyEvent
class to capture specific keys.
For example, to capture the LEFT, RIGHT, and CENTER D-Pad button (as well as the A button on a game controller), use this code:
@Override
public boolean onKeyDown(int keyCode, KeyEvent event){
boolean handled = false;
switch (keyCode){
case KeyEvent.KEYCODE_DPAD_CENTER:
case KeyEvent.KEYCODE_BUTTON_A:
// ... handle selections
handled = true;
break;
case KeyEvent.KEYCODE_DPAD_LEFT:
// ... handle left action
handled = true;
break;
case KeyEvent.KEYCODE_DPAD_RIGHT:
// ... handle right action
handled = true;
break;
}
return handled || super.onKeyDown(keyCode, event);
}
As with all input events, your listener method should return true
to capture the event and handle it, or pass that event on to super.onKeyDown()
so that other controls can manage it.
Input Event Reference
The following table describes the buttons, the Android KeyEvent
constants, and the default behavior of those buttons. None of the Amazon Fire TV remotes raises motion events (from the Android MotionEvent
class).
If you do not capture a specific input event the default behavior occurs.
Button | KeyEvent | Default Behavior |
---|---|---|
Home | none | Return the user to the Home screen. This is a system event and cannot be intercepted. |
Back | KEYCODE_BACK |
Return the user to the previous operation or screen (Activity). |
Menu | KEYCODE_MENU |
Invoke the Android context menu (OptionsMenu). |
Microphone (Search) (Voice Remote only) | none | Invoke the system voice search. This is a system event and cannot be intercepted. |
Select (D-Pad Center) | KEYCODE_DPAD_CENTER |
Select the user interface item with the current focus. |
Up (D-Pad) | KEYCODE_DPAD_UP |
Move the focus upward in the user interface. |
Down (D-Pad) | KEYCODE_DPAD_DOWN |
Move the focus downward in the user interface. |
Left (D-Pad) | KEYCODE_DPAD_LEFT |
Move the focus left in the user interface. |
Right (D-Pad) | KEYCODE_DPAD_RIGHT |
Move the focus right in the user interface. |
Play/Pause | KEYCODE_MEDIA_PLAY_PAUSE |
Control media playback. Play/Pause is a toggle. |
Rewind | KEYCODE_MEDIA_REWIND |
Rewind or skip backwards in media playback contexts. |
Fast Forward | KEYCODE_MEDIA_FAST_FORWARD |
Fast Forward or skip ahead in media playback contexts. |
Channel up | KEYCODE_CHANNEL_UP |
Changes the channel up one number. |
Channel down | KEYCODE_CHANNEL_DOWN |
Changes the channel down one number. |
Last updated: Feb 06, 2024