Android Recording Incoming and Outgoing Calls
Asked Answered
P

4

41

I am trying to understand is there a way I can record calls incoming and outgoing on android phones 2.2 and above?

A client wants to record calls of the agents they make to the clients so that it can be later used to fill out some material. Instead of making the client wait while on call they want to do it later on.

Is this possible and what APIs do I need to use?

Prostatectomy answered 14/7, 2011 at 4:21 Comment(1)
HI all i faced same issue( Not getting other side voice ) with Samsung S7 and S8 other wise my prog is run very well on rest of phones Any idea about ?? #45881454Marras
E
34

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.

Ewart answered 14/7, 2011 at 4:43 Comment(5)
VOICE_CALL - Voice call uplink + downlink audio source VOICE_DOWNLINK - Voice call downlink (Rx) audio source VOICE_UPLINK - Voice call uplink (Tx) audio source are not working in android 4.0 do you have any idea on itMella
HI all i faced same issue( Not getting other side voice ) with Samsung S7 and S8 other wise my prog is run very well on rest of phones Any idea about ??Marras
Successfully record the caller voice only using "blog post" link. But unable to record receiver end voice... Why ?Aaren
To make it more clear. These AudioSources need CAPTURE_AUDIO_OUTPUT permission. Which is only granted to system applications. Second thing AudioSource.VOICE_COMMUNICATION doesn't need that permission and works well on pre 7.0 devices. But that doesn't record other side's voice on devices running 7.0 and above.Saurian
Seems only system apps can use the VOICE_CALL, UPLINK and DOWNLINK. I was tried lot of call recorder coding in my Lenovo Zuk Z2 plus mobile with several audio sources but none of them are worked in recording the receiver voice. Cube ACR and Automatic call recorder apps are working perfectly in my mobile. Anyone please let me know how they can achive it?Organology
T
3

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();
Theis answered 19/8, 2015 at 12:35 Comment(4)
Sorry but microphone reocord voice of receiver not incoming user voice.Cinchonism
I have implemented this code but incoming call starts recording after few seconds. Please provide solution or suggestion for time managementWinded
This just opens the mic and starts recording. It has nothing to do with a call.Stole
yes it is and this is the best way you will find to record because on some phones recording is not allowed.Theis
K
1

I am using mic to record phone audio and also use the Telephony manager to find the calling state.

private MediaRecorder recorder;

  recorder = new MediaRecorder();
        try {
            recorder.setAudioSource(MediaRecorder.AudioSource.VOICE_COMMUNICATION);
            recorder.setOutputFormat(MediaRecorder.OutputFormat.AMR_NB);
            recorder.setAudioEncoder(MediaRecorder.AudioEncoder.AMR_NB);
            recorder.setAudioSamplingRate(44100);
            recorder.setOutputFile(your_desired_files_absoulte_path);
} catch (Exception e) {
e.printstacktrace ;
}

after that, you can easily start recording anywhere you want

recorder.prepare();
recorder.start();

and after finishing recording you can easily also stop the recording

recorder.stop();
recorder.reset();
recorder.release();
Kyongkyoto answered 9/8, 2020 at 10:25 Comment(0)
M
-16

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.

Muscle answered 23/11, 2013 at 7:51 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.