I asked Wikipad and they gave me access to this document which appears not to be available elsewhere:
I also found this very useful:
https://devs.ouya.tv/developers/docs/controllers
Basically the answer is that you override the onGenericMotionEvent callback of a view or activity.