5

I used Settings.apk and Launcher2.apk to access to Android setting and paired Glass with my Bluetooth keyboard device. Now I can use arrow keys, escape and return to control my glass. If I only use left and right arrows I can not select to some items in Glass but I can select every thing by swipe forward and back on touchpad. Is there a keycode that can be directly mapped to touchpad action? Or does it needs special HID consumer report?

Deqing
  • 188
  • 1
  • 9

1 Answers1

5

The KeyEvent's action you can intercept is ACTION_DOWN.

The key codes are:

  • KEYCODE_DPAD_CENTER (tap)
  • KEYCODE_TAB (horizontal swipes; isShiftPressed() returns true for backward [left] swipes and false for forward [right] swipes)
  • KEYCODE_CAMERA (camera button)
  • KEYCODE_BACK (swipe down, acts like back button)

There is no key code equivalent for a swipe up.

Fernando Gallego
  • 4,064
  • 31
  • 50
  • Thanks, I tried tab, shift tab and they works well in apps but not in Glass interface. I tried arror left and right and they don't work in apps. Which is weird. – Deqing Aug 17 '13 at 21:44
  • I wrote a simple activity that prints onKeyDown events and I got those, try using KEYCODE_DPAD_LEFT and KEYCODE_DPAD_RIGHT or write your own to see what events are fired. – Fernando Gallego Aug 18 '13 at 10:11
  • @ferdy182 I've tried that and am having no luck with DPAD RIGHT/LEFT. They just don't get captured at all. Here's a gist: https://gist.github.com/tetreault/0036ec122cae50c540e9 – Stephen Tetreault Nov 07 '14 at 17:35
  • I don't think that works anymore, now you have to use a gesture detector. See the docs https://developers.google.com/glass/develop/gdk/touch – Fernando Gallego Nov 09 '14 at 10:04