2017-01-02 96 views
0

m新的android,只是试图记录这些电话。挂断后,录音应该保存,但不存在。有人可以帮我一下吧通话记录不保存记录

public void startRecording() throws IOException { 
    ditchRecord(); 
    File outFile=new File(OUTPUT_FILE); 
    if(outFile.exists()){ 
     outFile.delete(); 
    } 
    recorder= new MediaRecorder(); 
    recorder.setAudioSource(MediaRecorder.AudioSource.VOICE_CALL); 
    recorder.setOutputFormat(MediaRecorder.OutputFormat.THREE_GPP); 
    recorder.setAudioEncoder(MediaRecorder.AudioEncoder.AMR_NB); 
    recorder.setOutputFile(OUTPUT_FILE); 
    recorder.prepare(); 
    recorder.start(); 

} 

private void ditchRecord() { 
    if(recorder!=null) 
     recorder.release(); 
} 
+1

请检查这个http://www.truiton.com/2015/05/capture-record-android-screen-using-mediaprojection-apis/ – Shailesh

回答

2
基础上 documentation

从VOICE_CALL源捕捉需要CAPTURE_AUDIO_OUTPUT许可。此权限仅供系统组件使用,并且不适用于第三方应用程序。

因此,它看起来像你试图做的是不可能的,除非你的应用程序被安装为一个系统应用程序,它只会在根设备上工作。

+0

然而,如果它为个人使用,根植电话可以授予系统权限任何应用程序,你只需要正确安装它。 –

+0

你说得对,我会更新我的答案。 – Egor

+0

thanx强硬,我扎根于我的,但我试图让它在其他设备上工作 –