Couldn't hear incoming voice in recorded calls in android 7?

Viewed 4589

I am developing an Android app for recording calls. This is my code snippet.

    recorder = new MediaRecorder();
    recorder.setAudioSource(MediaRecorder.AudioSource.DEFAULT);
    recorder.setOutputFormat(MediaRecorder.OutputFormat.DEFAULT);
    recorder.setAudioEncoder(MediaRecorder.AudioEncoder.AAC);
    recorder.setOutputFile(file_path);

This is working perfectly for devices below android 7, but when I use Android 7 mobile devices I can hear only outgoing voice but cannot hear incoming voice.

Can anyone help me in fixing it?

4 Answers

Well, the problem is that you only record the microphone input with that code, which is obviously just the outgoing voice. To also record the incoming voice, you'd have to also record system sound.

To record system sound, you'll have to google a bit. Here are some stackoverflow links that should get you started:

In the end, you'd also have to merge the two soundtracks into one file to have the whole call as one.

recorder.setAudioSource(MediaRecorder.AudioSource.MIC);
recorder.setOutputFormat(MediaRecorder.OutputFormat.MPEG_4);
recorder.setAudioEncoder(MediaRecorder.AudioEncoder.AMR_NB);

try using this

Related