Reputation: 167
m new to android, was just trying to record the calls. After hanging up, recording should be saved but it's not there in storage. can somebody help me with it
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();
}
Upvotes: 0
Views: 185
Reputation: 40218
Based on the documentation,
Capturing from VOICE_CALL source requires the CAPTURE_AUDIO_OUTPUT permission. This permission is reserved for use by system components and is not available to third-party applications.
Hence, it looks like what you're trying to do is not possible, unless your app is installed as a system app, which will only work on rooted devices.
Upvotes: 2