Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Reacting to multi-buttons wired headphones

I am driving some experiments with a pair of a-JAYS Four headphones (having 3 buttons on its wired remote/mic) plugged onto a Galaxy Nexus (ICS 4.0.2).

My issue is that only the middle button is 'recognised' by a test app I have written, i.e. triggering both Intent.ACTION_MEDIA_BUTTON and/or Activity.onKeyDown callback with KeyCode 79 when it is pressed.

Pressing the two other buttons don't trigger any of the previous methods. For info, those headphones and its 3 buttons work on Apple iPhones and Apple computers (at least a MacBookPro 2011), as advertised on the box...

Firstly I thought Android or my device could simply not handle more than one button on a wired jack remote (even if that sounds weird...) but then I had a try with a pair of headphones from HTC (the ones coming with one of their Desire device) having 3 buttons. Middle button would react the same way as my a-JAYS, but the two other buttons are also recognised with KeyCodes 87 and 88, respectively Play Previous and Play Next media keys.

So it seems that either the device or the low levels layers of Android are simply not able to catch certain headphones buttons signals :/ (at least those which are not 87 and 88)

Any idea anyone about how to make Android able to recognise other buttons/signals from such headphones as Apple compatible ones? Would it imply low levels drivers writing for ICS or am I missing something really obvious?

Any help would be much appreciated. Can post my test-app code if needed.

Cheers

like image 892
Attila Avatar asked Apr 11 '12 23:04

Attila


1 Answers

The signals/ resistance from the volume control buttons (1.525-1.495 V for volume down, and 1.619-1.587 V for volume up) are currently unable to be recognized through the android framework's software. I believe this has to do with Apple having a patent on the designated volume controls and so Google won't release to developers how the framework recognizes particular signals through the fourth connector on the headphone jack. The center/mic/action buttons on headsets generally work, it shorts the path from ~2V to ~0V and Apple does not own the patent for that. If someone could figure out how to interact with the inputs on their own that would be huge. I am tempted to learn app development and find a workaround.

like image 141
Adam C Avatar answered Oct 26 '22 11:10

Adam C