Send signals through headphone cable
I've done quite a bit of searching on this but haven't found anything.
I have an idea for an app to control a device, that would need to connect t开发者_C百科hrough the headphone cable.
Is it possible to send signals through the headphone socket?
Arbitrary data can be played out audio jack using Media Player
with a raw resource. The signal would be limited by the bandwidth of the particular device, for example between 20 Hz and 16 KHz.
use AudioManager
AudioManager audioManager = (AudioManager) this.getSystemService(Context.AUDIO_SERVICE);
http://developer.android.com/reference/android/media/AudioManager.html
Then you can setWiredHeadsetOn(true) or if it won't work play with setMode
精彩评论