While working on an internship I had to connect a number of push button to an embedded android device (WaRP board) to use as an input. The board uses a ARM cortex Freescale i.MX 6 SoloLite processor. A brief overview of what the board has to offer can be seen here.
In order to do so, I made this system service which runs in the background and reads from any number of push buttons connected over GPIO. The service is capable of detecting stardard button presses (single, double and long).

The service is available on Github.
The documentation is available on Github as well but can also be found here.
The input is read from GPIO using a thread written in C which callsback to Java through the Java Native Interface (JNI).

Software block diagram:

The button I used, I debounced with hardware using the following low pass network: