I'm creating an Android app that allows to record and play audios. The setup is the following: there is an external microphone connected to the android phone through USB OTG (for recording purposes) and headphones connected to the audio jack of the phone (for playing purposes). However, MediaRecorder identifies the microphone of the headphone as the default microphone, instead of the external microphone.
The recording with external mic works without the headphones connected to the audio jack.
recorder = new MediaRecorder();
recorder.setAudioSource(MediaRecorder.AudioSource.DEFAULT);
recorder.setOutputFormat(MediaRecorder.OutputFormat.THREE_GPP);
recorder.setOutputFile(fileName);
recorder.setAudioEncoder(MediaRecorder.AudioEncoder.AMR_NB);
I would like to have as Audio Source the external mic and the headphones only for playing purposes. Is there any way I can do that? Can I set audio jack as ONLY output?