Victor Grazi Victor Grazi - 1 month ago 6
Android Question

Phone freezes when recording phone call

I am trying to build an app that needs to record phone calls (mostly outgoing)

I have tried to set the media source to MediaRecorder.AudioSource.VOICE_CALL, which always causes the app to freeze.

I have also tried to set the media source to MediaRecorder.AudioSource.VOICE_DOWNLINK, but this crashes as soon as it connects to the phone call.

I have tried the following permissions:

<uses-permission android:name="android.permission.MODIFY_AUDIO_SETTINGS"/>
<uses-permission android:name="android.permission.READ_PHONE_STATE"/>
<uses-permission android:name="android.permission.Permissions.PROCESS_OUTGOING_CALLS"/>

But nothing works.

Any advice for recording phone calls.

Also, I have found some old posts that say only some phones allow recording voice calls.

Is there any way to detect programmatically if this app is running on such a phone (if not, I can direct them to use speaker phone or something)


Answer Source

To accomplish that you would need all of these, I believe:

<uses-permission android:name="android.permission.PROCESS_OUTGOING_CALLS" />
<uses-permission android:name="android.permission.READ_PHONE_STATE" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.MODIFY_AUDIO_SETTINGS" />
<uses-permission android:name="android.permission.RECORD_AUDIO" />
<uses-permission android:name="android.permission.WAKE_LOCK" />
<uses-permission android:name="android.permission.CALL_PHONE" />

and most likely

<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" /> 

Of course, you would want to be sure all the appropriate warnings and EULAs are in place.

Not sure if what you posted

<uses-permission android:name="android.permission.Permissions.PROCESS_OUTGOING_CALLS"/>

is a typo but it should be

<uses-permission android:name="android.permission.PROCESS_OUTGOING_CALLS"/>

Like you said: old posts talk about the fact that some devices do not support the call recording feature.

  • Is there any way you can test on other devices, or ask friends or a small group of testers to try on other devices...the problem seems to be entirely device specific.

I would recommend trying the above permissions and seeing if you can test on other devices to narrow down if it's device or programming issue, and if it's device then you can know that and better find a possible workaround.