I'm getting problem in recording voice call in android lollipop and higher version. By this code I'm able to record my voice, but not able to record other person voice.
public void startRecording() {
if (recording == false) {
Log.e("here", "--------Recorder_Sarted------" + fname);
SimpleDateFormat sdf = new SimpleDateFormat("ddMMyyyy");
int randomPIN = (int) (Math.random() * 9000) + 1000;
recorder.setAudioSource(MediaRecorder.AudioSource.VOICE_COMMUNICATION);
recorder.setOutputFormat(MediaRecorder.OutputFormat.THREE_GPP);
recorder.setAudioEncoder(MediaRecorder.AudioEncoder.AMR_NB);
String file = Environment.getExternalStorageDirectory().toString();
String filepath = file + "/Aeris/Recording";
File dir = new File(filepath);
dir.mkdirs();
Log.e("here ", "----------------" + sdf.format(Calendar.getInstance().getTime()) + " " + fname + " " + type);
filepath += "/" + type + "-" + fname + "-" + sdf.format(Calendar.getInstance().getTime()) + "-" + randomPIN + ".3gp";
recorder.setOutputFile(filepath);
try {
recorder.prepare();
} catch (IllegalStateException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
recorder.start();
recording = true;
}
}
This code is working fine below android lollipop version. please help me to solve this problem