I want to record voice for incoming and outgoing line during call. I have tried many solutions which otherwise work on devices other than Moto Phones(In my case I have tried on Moto E(2nd gen), Moto G5 and Moto C). I have tried this two libraries:
- call-recorder-for-android This library, first of all, crashese with following log trace
03-07 10:56:57.307 293-9261/? E/AudioRecord: Could not get audio input for record source 4, sample rate 8000, format 0x1, channel mask 0x10, session 3494, flags 0 03-07 10:56:57.308 293-9261/? E/StagefrightRecorder: audio source is not initialized 03-07 10:56:57.309 7290-7290/com.callrecorder.android E/MediaRecorder: start failed: -2147483648 03-07 10:56:57.314 7290-7290/com.callrecorder.android E/Call recorder: Failed to set up recorder. java.lang.RuntimeException: start failed. at android.media.MediaRecorder.start(Native Method) at com.callrecorder.android.RecordService.startRecording(RecordService.java:194) at com.callrecorder.android.RecordService.onStartCommand(RecordService.java:92) at android.app.ActivityThread.handleServiceArgs(ActivityThread.java:3028) at android.app.ActivityThread.-wrap17(ActivityThread.java) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1452) at android.os.Handler.dispatchMessage(Handler.java:102) at android.os.Looper.loop(Looper.java:148) at android.app.ActivityThread.main(ActivityThread.java:5443) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:728) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:618)
According to official Android documentations
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.
So, I tried to change AudioSource to AudioSource.VOICE_COMMUNICATION
which worked without crashing. But not able to record incoming voice. It only records outgoing voice. I've tried the same with AudioSource.DEFAULT
but again no luck. It behaves same as AudioSource.VOICE_COMMUNICATION
This library has some tweaks at NDK level. But that too have given the same result as above library with AudioSource.VOICE_COMMUNICATION
According to MOTO's official forum this discussion thread Motorola officials say that, they don't support VOICE CALL recording internally but some third party application may be able to do it. Which is actually right. Automatic Call Recorder application in play store provides working solution for the same. I am not able to find what kind of modifications it has done, which gave it a working solution. Any help would be appreciated
CAPTURE_AUDIO_OUTPUT
permission. Give it a check with earphones. – FormulateAudioSource,VOICE_COMMUNICATION
and setting volume to max during call. It is working on Moto G4 play. – FormulateAudioSource,VOICE_COMMUNICATION
it doesn't work, it only records outgoing voice. – SkilkenAudioSource.VOICE_COMMUNICATION
also uses microphone to record audio, so voice coming from ear-piece must be loud enough that mic can capture it. – Formulate