Android Recording Incoming and Outgoing Calls

百般思念 提交于 2019-11-26 19:31:24
Shane Powell

First off, you have to be careful with recording calls as there are legal requirements depending on the country.

Here is a blog post on how to record audio using the MediaRecorder.

I haven't tried recording phone call's but there is a option in MediaRecorder AudioSource for:

  • VOICE_CALL - Voice call uplink + downlink audio source
  • VOICE_DOWNLINK - Voice call downlink (Rx) audio source
  • VOICE_UPLINK - Voice call uplink (Tx) audio source

As long as the audio source options work, you should be good to go.

Bilal Shahid

I am using mic to record calls for better support and compatibility.

MediaRecorder recorder = new MediaRecorder();
recorder.reset();
recorder.setAudioSource(MediaRecorder.AudioSource.MIC);
recorder.setOutputFormat(MediaRecorder.OutputFormat.MPEG_4);
recorder.setAudioEncoder(MediaRecorder.AudioEncoder.AAC);
recorder.setOutputFile(your_desired_folder_path);
 try {
    recorder.prepare();
} catch (java.io.IOException e) {
    recorder = null;
    return;
}
recorder.start();
kkreddy

Call recording programmatically is erratic on android version 4 and is established to be only one side (even if possible) for security reasons. Many vendors have their own hardware implementations for call recording. There was a case in my app where I had to record a conference call by pressing hold and add a new call. The moment I pressed hold call recording stopped becuase the incall mode was gone.

to record just hit the menu button while in call in android phone it will store conversation in amr format and in root directory of sd card max 20min conversation.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!