I am having trouble recording a voice call in android lollipop and later. By this code I can record my voice, but I could not record the voice of another person.
public void startRecording() { if (recording == false) { Log.e("here", "--------Recorder_Sarted------" + fname); SimpleDateFormat sdf = new SimpleDateFormat("ddMMyyyy"); int randomPIN = (int) (Math.random() * 9000) + 1000; recorder.setAudioSource(MediaRecorder.AudioSource.VOICE_COMMUNICATION); recorder.setOutputFormat(MediaRecorder.OutputFormat.THREE_GPP); recorder.setAudioEncoder(MediaRecorder.AudioEncoder.AMR_NB); String file = Environment.getExternalStorageDirectory().toString(); String filepath = file + "/Aeris/Recording"; File dir = new File(filepath); dir.mkdirs(); Log.e("here ", "----------------" + sdf.format(Calendar.getInstance().getTime()) + " " + fname + " " + type); filepath += "/" + type + "-" + fname + "-" + sdf.format(Calendar.getInstance().getTime()) + "-" + randomPIN + ".3gp"; recorder.setOutputFile(filepath); try { recorder.prepare(); } catch (IllegalStateException e) {
This code works fine under the winch version for Android. please help me solve this problem.
source share