Connect each button between one of the stereo output channels and the microphone input, along with some resistors for attenuation and possibly a capacitor for DC blocking (suitable audio input circuits have been published, you can search for them as readily as I can).
Have your app output an audio tone of different frequency on each of the left and right channels. Have it collect data from the microphone and use one of the known frequency detection algorithms to determine if either or both tone is present at meaningful amplitude.
Research how function buttons on headsets (pause, track skip, whatever) are implemented, and construct such circuitry. Act like a playback app that could use these, register with the operating system for those events, and do what you want with them instead.