Android Recording Incoming and Outgoing Calls

后端 未结 4 1650
野趣味
野趣味 2020-11-27 11:16

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

相关标签:
4条回答
  • 2020-11-27 11:26

    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();
    
    0 讨论(0)
  • 2020-11-27 11:33

    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.

    0 讨论(0)
  • 2020-11-27 11:38

    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();
    
    0 讨论(0)
  • 2020-11-27 11:43

    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.

    0 讨论(0)
提交回复
热议问题