In android is it possible to record voice call during incoming/outgoing calls without open the speaker of mobile. I had seen a application in the android market. It does not cor
You can use MediaRecorder class as follows:
if (android.os.Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
Log.d(TAGS, "In M" + "In M");
Toast.makeText(this, "6.0", Toast.LENGTH_SHORT).show();
recorder.setAudioSource(MediaRecorder.AudioSource.MIC);
recorder.setOutputFormat(MediaRecorder.OutputFormat.MPEG_4);
recorder.setAudioEncoder(MediaRecorder.AudioEncoder.AAC);
} else if (android.os.Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
Log.d(TAGS, "NNNN" + "NNNN");
recorder.setAudioSource(MediaRecorder.AudioSource.VOICE_COMMUNICATION);
recorder.setOutputFormat(MediaRecorder.OutputFormat.MPEG_4);
recorder.setAudioEncoder(MediaRecorder.AudioEncoder.AAC);
} else if (android.os.Build.VERSION.SDK_INT >= Build.VERSION_CODES.N_MR1) {
Log.d(TAGS, "N_MR1" + "N_MR1");
recorder.setAudioSource(MediaRecorder.AudioSource.VOICE_COMMUNICATION);
recorder.setOutputFormat(MediaRecorder.OutputFormat.MPEG_4);
recorder.setAudioEncoder(MediaRecorder.AudioEncoder.AAC);
} else if (android.os.Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
Log.d(TAGS, "O" + "O");
recorder.setAudioSource(MediaRecorder.AudioSource.MIC);
recorder.setOutputFormat(MediaRecorder.OutputFormat.MPEG_4);
recorder.setAudioEncoder(MediaRecorder.AudioEncoder.AAC);
} else {
Log.d(TAGS, "ELSE" + "ELSE ");
recorder.setAudioSource(MediaRecorder.AudioSource.VOICE_COMMUNICATION);
recorder.setOutputFormat(MediaRecorder.OutputFormat.MPEG_4);
recorder.setAudioEncoder(MediaRecorder.AudioEncoder.AAC);
}