I busy working on Android call recorder, When I make a call the recorder shows it is recording, after I drop the call, it saves the file, but the saved file is 0 KB
Has any one come across with the same problem, please help me on this.
Here is my code for recording
recorder = new MediaRecorder();
recorder.setAudioSource(MediaRecorder.AudioSource.VOICE_CALL);
recorder.setOutputFormat(MediaRecorder.OutputFormat.THREE_GPP);
recorder.setAudioEncoder(MediaRecorder.AudioEncoder.AMR_NB);
myFileName = getFilename();
recorder.setOutputFile(myFileName);
volume = (AudioManager) getSystemService(Context.AUDIO_SERVICE);
//set the volume a bit high for good sound
int volume_level = volume.getStreamVolume(AudioManager.STREAM_VOICE_CALL);//get the current volume set
int max_volume = volume.getStreamMaxVolume(AudioManager.STREAM_VOICE_CALL);//set volume to maximum
if (volume_level < max_volume) {volume.setStreamVolume(AudioManager.STREAM_VOICE_CALL, max_volume, AudioManager.FLAG_SHOW_UI);//set volume to maximum
}
//Log.d(tag, myFileName);
Log.d(tag, "File path = " + myFileName);