How to navigate google map in android tv app using remote d-pad?

98 views Asked by At

I already have a mobile map application so I know all basic map functionalities. Now I want to build a TV version of it but I didn't know how to move/pan/drag map in Android TV using dpad..

I've tried OnFocusListener, OnKeyListener/DispatchKeyEvent method with Map Gestures Controls.

switch (keyCode) {
    case KeyEvent.KEYCODE_DPAD_UP:
    // Do something when the up button is pressed
      break;
    case KeyEvent.KEYCODE_DPAD_DOWN:
    // Do something when the down button is pressed
      break;
    case KeyEvent.KEYCODE_DPAD_LEFT:
    // Do something when the left button is pressed
      break;
    case KeyEvent.KEYCODE_DPAD_RIGHT:
      // Do something when the right button is pressed
      break;
    default:
      return false;
}
0

There are 0 answers