Record phone calls on android phone?

前端 未结 5 1468
执笔经年
执笔经年 2020-12-01 02:39

I tried it and use the following code for recording outgoing calls but it does not..

  @Override
  public void onReceive(Context context, Intent intent) 
  {         


        
相关标签:
5条回答
  • 2020-12-01 02:42

    It seems that you cannot record a call from the API. One common workaround is to engage the speakerphone and record from the microphone - on many devices, the microphone will pick up the speaker adequately with this arrangement.

    Another workaround is to do the recording on a telephony service somewhere and route calls through it.

    0 讨论(0)
  • 2020-12-01 02:48

    This code is working for me to record outgoing phone calls,so please check it Here

    0 讨论(0)
  • 2020-12-01 02:56

    This can be solved with API level 8+. Set your audio source for media recorder as phone uplink, downlink, or both.

    recorder.setAudioSource(MediaRecorder.AudioSource.VOICE_CALL); //Voice downlink/ Uplink
    recorder.setOutputFormat(MediaRecorder.OutputFormat.THREE_GPP);
    recorder.setAudioEncoder(AudioEncoder.AAC );
    

    But beware of the law and regulations before doing this.

    0 讨论(0)
  • 2020-12-01 03:06
    1. You cannot record phone calls very well in Android, because the in-call audio is not available to SDK applications
    2. ACTION_ANSWER is not a broadcast Intent
    0 讨论(0)
  • 2020-12-01 03:06

    You cannot record call simply by media recorder. you have to also change the setting of audio manager and put the loud speaker on before starting recording and the audio source will remain same(mic).So try to edit audio manager's setting


    AudioManager audiomanager = (AudioManager)context.getSystemService("audio"); 
    int i = audiomanager.getRouting(2); 
    audiomanager.setMode(2);
    audiomanager.setMicrophoneMute(false);
    audiomanager.setSpeakerphoneOn(true); 
    int j = audiomanager.getStreamMaxVolume(0); 
    if(j < 0) 
         j = 1; 
    int k = j / 2 + 1; 
    audiomanager.setStreamVolume(0, k, 0); 
    audiomanager.setRouting(2, 11, 15);
    
    0 讨论(0)
提交回复
热议问题