I'm working auto call recorder app, I'm able to record voice call on below android Marshmallow using MediaRecorder.AudioSource.VOICE_CALL, From android marshmallow not able to record voice call using VOICE_CALL. I managed to record using MediaRecorder.AudioSource.MIC but here incoming voice not getting recorded and I want to record voice call in normal mode, not in speaker mode. I tried many examples and search a lot then I write this question. Please Help Me. There is an app on Google play that record both side voice in the call, Named "Call Recorder - Automatic Call Recorder" How it is working in marshmallow, Is there any other way to record the call?
int Media;
if (Build.VERSION.SDK_INT >= 24) {
Media = MediaRecorder.AudioSource.VOICE_COMMUNICATION;
}else if (Build.VERSION.SDK_INT==23){
Media = MediaRecorder.AudioSource.MIC;
}
else{
Media = MediaRecorder.AudioSource.VOICE_CALL;
}
CallRecord callRecord = new CallRecord.Builder(this)
.setRecordFileName("")
.setRecordDirName("CallRecord")
.setRecordDirPath(Environment.getExternalStorageDirectory().getPath())
.setAudioEncoder(MediaRecorder.AudioEncoder.AMR_NB)
.setOutputFormat(MediaRecorder.OutputFormat.AMR_NB)
.setAudioSource(Media)
.setShowSeed(true)
.build();
callRecord.startCallRecordService();