0
votes

Run time exception in

                recorder = new MediaRecorder();
                recorder.setAudioSource(MediaRecorder.AudioSource.VOICE_CALL);
                recorder.setOutputFormat(MediaRecorder.OutputFormat.THREE_GPP);
                recorder.setAudioEncoder(MediaRecorder.AudioEncoder.AMR_NB);
                recorder.setOutputFile(audiofile.getAbsolutePath());

java.lang.RuntimeException: Error receiving broadcast Intent { act=android.intent.action.NEW_OUTGOING_CALL flg=0x10000010 (has extras) } in a.callrecoder.TService$a@e5c022 at android.app.LoadedApk$ReceiverDispatcher$Args.run(LoadedApk.java:1138) at android.os.Handler.handleCallback(Handler.java:751) at android.os.Handler.dispatchMessage(Handler.java:95) at android.os.Looper.loop(Looper.java:154) at android.app.ActivityThread.main(ActivityThread.java:6184) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:898) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:788) Caused by: java.lang.RuntimeException: start failed. at android.media.MediaRecorder.start(Native Method) at a.callrecoder.TService$a.onReceive(Unknown Source) at android.app.LoadedApk$ReceiverDispatcher$Args.run(LoadedApk.java:1128) at android.os.Handler.handleCallback(Handler.java:751)  at android.os.Handler.dispatchMessage(Handler.java:95)  at android.os.Looper.loop(Looper.java:154)  at android.app.ActivityThread.main(ActivityThread.java:6184)  at java.lang.reflect.Method.invoke(Native Method)

1
change setAudioSource(MediaRecorder.AudioSource.VOICE_CALL) TO setAudioSource(MediaRecorder.AudioSource.MIC) . It will work on android 6.0 and above. Make sure all permission's are allowed. - Hemant Parmar
but i want to record downlink not mic voice MediaRecorder.AudioSource.MIC record only my voice - Gajendra Singh
which device are you testing it - avez raj
have look this - Hemant Parmar
mi redmi 4 is the device and android version is 7.0.1 - Gajendra Singh

1 Answers

0
votes

The MediaRecorder.AudioSource.VOICE_CALL source requires CAPTURE_AUDIO_OUTPUT permission which will be granted just for system apps and NOT for 3rd-party applications.