javaandroidaudiogalaxysamsung-mobile

Route MIC input through headset and AUDIO output through phone's speaker


is there a way to route microphone input through headset and use simultaneously the AUDIO output through smartphone's speaker ?

I've been watching around for hours now and I saw that it's clearly impossible on iOS but what about Android..

I'm using a Samsung Galaxy S4.

Here is a part of my code to route the audio output through the speaker even if the headset is plugged in :

AudioManager speakerOutput = (AudioManager) getSystemService(Context.AUDIO_SERVICE);
speakerOutput.setMode(AudioManager.MODE_IN_CALL);
speakerOutput.setSpeakerphoneOn(true);

But then when I tried to control my app by the headset's microphone, nothing. So I tried with the smartphone's one and it's obviously working.

It don't seems like others AudioManager.MODEs route audio output only and leave the mic input to the headset. So what can I do now without having to build a new kernel, modify drivers, HAL, …etc ?

Thanks, C.


Solution

  • There is no way to loopback from headset Mic to Speaker if you do not change HAL or driver on Android. If u can change hardware, it possible works out.