I am creating an app for recording voice calls which is working fine on almost all devices. My problem is that the incoming voice is not recorded while making a call with earphones. I tried a number of ways to achieve this but failed to overcome this problem.
I tried with MediaRecorder
and AudioRecord
. As an example, here is my MediaRecorder sample:
MediaRecorder mediaRecorder = new MediaRecorder();
mediaRecorder.setAudioSource(MediaRecorder.AudioSource.MIC);
mediaRecorder.setAudioSamplingRate(8000);
mediaRecorder.setAudioEncodingBitRate(12200);
mediaRecorder.setOutputFormat(MediaRecorder.OutputFormat.THREE_GPP);
mediaRecorder.setAudioEncoder(MediaRecorder.AudioEncoder.AMR_NB);
mediaRecorder.setOutputFile(phoneCall.getPathToRecording());
mediaRecorder.prepare();
mediaRecorder.start();
Any suggestion is appreciated.