How in Android (for example 4.4), programmatically on java, to reproduce the sound from the microphone to the headphone? It is advisable not to use the AudioRecord entry, but to redirect the MIC stream to WiredHeadset . I suspect that AudioManager can, but how?

To check headphones:

 if (audioManager.isWiredHeadsetOn()) { } 

microphone:

 if (audioManager.isMicrophoneMute()) { audioManager.setMicrophoneMute(false); } 

But then how?

  • It’s unlikely to redirect, you still have to use AudioRecord - try setting the minimum buffer size - Barmaley
  • The question is not simple. Maybe someone knows how to do it. I understand that the delay with a small buffer is negligible. But write buffer and read it. And the threads to connect? - P.Shevchuk

0