6

Call recorder is recording blank for the duration in Android 10 (Pixel 3A). It was working fine for all phones till Android 8 and in Android 9 most phones were recording only one side voice (however it was working fine in pixel 3A)

Is there any way to record calls in Android 10?

The below code doesn't seem to be working anymore.

    int audioSource = MediaRecorder.AudioSource.VOICE_CALL;
    mediaRecorder.setAudioSource(audioSource);
    mediaRecorder.setOutputFormat(MediaRecorder.OutputFormat.MPEG_4);
    mediaRecorder.setAudioEncoder(MediaRecorder.AudioEncoder.AAC);
    mediaRecorder.setAudioEncodingBitRate(32);
    mediaRecorder.setAudioSamplingRate(44100);
    mediaRecorder.setOutputFile(MediaUri);
    mediaRecorder.prepare();
    mediaRecorder.start();

If SDK 28 or below is used call recording happens for the whole duration but without any voice. If SDK 29 is used call recording fails at the beginning saying check available audio from callback.

I hope its a bug in Google Android 10 and some patch will fix it.

Srihari Karanth
  • 2,067
  • 2
  • 24
  • 34
  • it's not a bug, google restricted call recording feature to the only system apps – Bhanu Prakash Pasupula Oct 04 '19 at 06:29
  • There is a new API in Android Q(AudioPlaybackCapture API) to record internal audio: https://android-developers.googleblog.com/2019/07/capturing-audio-in-android-q.html https://developer.android.com/guide/topics/media/playback-capture – LCZ May 13 '20 at 10:04
  • 1
    @lcz does this work? Have you tried? I havnt seen any app using this. The only working apps are using accessibility feature. – Srihari Karanth May 13 '20 at 13:31
  • I have not tried it, but I have seen a third-party app that does: https://www.androidpolice.com/2019/09/18/adv-screen-recorder-internal-audio-android-10/ – LCZ May 13 '20 at 13:43

3 Answers3

5

It's possible using Accessibility Service.

Remote call recorder and BoldBeast both record perfectly both side voice in Android 10 (Pixel 3A) without having to root or being a system app. Both of them use Accessibility service.

Detailed info here in this link.

Srihari Karanth
  • 2,067
  • 2
  • 24
  • 34
  • Plug in a headset and check if the other side is recorded – ZAB Oct 28 '19 at 10:02
  • With headset it obviously will not record as the microphone will not be receiving any audio. – Srihari Karanth Oct 28 '19 at 11:18
  • 2
    @ZAB, What is misleading? There is a way to record calls and Cube call recorder is doing it, is what I meant. How is the cube call recorder recording it if it's completely disabled? – Srihari Karanth Oct 30 '19 at 05:18
  • 3
    You aren't recording calls. You are recording background using mic. Call recording feature was removed from Android. Stop advertising this app please, there are plenty of other apps doing the same. – ZAB Oct 30 '19 at 09:23
  • @ZAB, What is call recording? Its recording mic using audio service when you get broadcast of incoming or outgoing calls. Even in earlier version of android calls using earphones were not getting recorded. My question was what is the workaround to record in android 10 and I was looking answer from people who have implemented it and not negative answers that the old approach is not working. Cube call recorder has shown that it's possible. If you dont know, let others who know reply. – Srihari Karanth Oct 30 '19 at 10:10
  • 1
    In android 8 it was a separate sound device MediaRecorder.AudioSource.VOICE_CALL mirroring the line and it was possible to record clear sound directly from the line. This feature was later removed. Recording the surrounding through the MIC hoping to catch some noisy sound from the speaker is nowhere close. – ZAB Oct 31 '19 at 12:46
  • 4
    I am using both Cube and Pixel with Android 10, it's just saving recording without any sound. – Jahangir Kabir Nov 20 '19 at 15:02
  • @jahangir, you need to give accesbility permission for it to work. It's working perfectly fine in my pixel 3a. Even boldbeast works fine. – Srihari Karanth May 07 '20 at 15:35
  • 1
    I've managed to deploy an Accessibility Service + MediaRecorder + Accessibility Overlay. MediaRecorder's audio source MUST be configured as VoiceRecognition. The transparent/non-interactive overlay serves as a priorization proxy, as Android Reference says "If the service's UI is on top, both the service and the app receive audio input. This behavior offers functionality like controlling a voice call or video capture with voice commands.". Actually it also works without the overlay, I was able to finally capture outgoing WhatsApp voice messages. – LuckyScooby Jul 28 '20 at 20:58
  • @LuckyScooby Where can I find an example about call recording from an Accessibility Service? Do you use onAccessibilityEvent for starting the recording and ending the recording(for example when the user pushes call and end call)? Do you listen for the default call app package? – Andrei Ciuca Aug 29 '20 at 12:19
  • @Srihari Karanth, Acr can record calls for my Pixel 3a with Android 10. But do you have a working example of recording a call from the Accessibility Service? – Andrei Ciuca Aug 29 '20 at 12:25
  • @AndreiCiuca My app doesn't have any activity, so I used Accessibility Service so I can turn it on/off on demand in Phone Settings. While turned on, as soon as phone boots, the service is started. I override onServiceConnected() to initialize everything: - Broadcast Receivers: screen on/off, charger plugged in/out, airplane mode on/off, etc; - Audio recorder class: as soon as the service is initialized I setup my MediaRecorder and call start(), so the target phone records everything 24/7. - I also call stop() when service is disconnected or device shuts down, so I don't end up corrupted. – LuckyScooby Aug 30 '20 at 17:02
  • @AndreiCiuca as for listening phone calls, I used to implement a broadcast receiver for checking phone state changes. It worked well, but then I realized I would just need to catch them (and every other item) as notifications, so I removed the receivers and setup the accessibility service info to listen for notifications as well, then I just needed to filter per app package name. – LuckyScooby Aug 30 '20 at 17:10
  • @AndreiCiuca Accessibility Service combined with broadcast receivers gives you access to everything going on the phone. If you want to stalk, you don't need admin, foreground service or dedicated notifications listener. You have all in one, just explore it. You don't even need a visual activity at all. My app works 100% as a service, there is not even an icon launcher after installing. Please, PM me and I'll send you some pieces of code that might help you. – LuckyScooby Aug 30 '20 at 17:13
  • Oh! and if anyone here disagrees on me stalking people: This person once broke my confidence on him, and in order to prove I could recover it, he agreed with me installing an app like this on his phone. I never released this thing to anyone else. :) – LuckyScooby Aug 30 '20 at 17:17
  • @LuckyScooby, Thank you for your reply. It seems that call recording works just if the accessibility service is running. For Pixel 3a you don't need to start the call recorder from the accessibility service. Since the Pixel phone has the most limitations regarding call recording, I hope that it should work on other phones. I have not tested this on other phones. Did you test VoiceRecognition on more than just the Pixel phone? On the Pixel phone VoiceCall and Microphone seem not to work. – Andrei Ciuca Aug 30 '20 at 18:50
  • @LuckyScooby can you please share with me a sample code? – pourjour Oct 12 '22 at 16:35
2

As per Google's new permission policy no other third party apps (Except system apps) can record calls from Android 9 Pie.

This change will not affect previous recordings or call recording in general.

MohanKumar
  • 960
  • 10
  • 26
2

I am using Realme2pro device having version android 10 it is working for me by using Accessibility try this code

To implement Accessibility go through this link

public class Accessibility extends AccessibilityService {

Service mService = null;

@Override
public void onAccessibilityEvent(AccessibilityEvent event) {
    Log.d("MyAccessibilityService", "Shrinidhi: onAccessibilityEvent");
}

@Override
public void onInterrupt() {

}


@Override
protected void onServiceConnected() {
    Log.d("MyAccessibilityService", "Shrinidhi: onServiceConnected");
}

@Override
public void onCreate() {
    this.mService = this;
    Log.d("MyAccessibilityService", "Shrinidhi: onCreate");
 }
}

and add AudioSource to recorder.setAudioSource(MediaRecorder.AudioSource.VOICE_RECOGNITION);

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

Hope it work :)

Prototype
  • 486
  • 1
  • 4
  • 17
  • 1
    What is your "Service mService = null;" ? Is it the call recording service? I have an example for the Call Recording on this link: https://github.com/tntkhang/call-recording-master Could you please take a look on it, it worked on android below 10, but with android 10 it got silent. – Khang Tran Nov 14 '20 at 02:46
  • Which device you are using? – Prototype Nov 14 '20 at 16:00
  • Can you please try without this lines `recorder.setAudioSamplingRate(44100); recorder.setAudioEncodingBitRate(96000);` – Prototype Nov 14 '20 at 16:01
  • @prototype86 did you found solution for your issue. i am also facing the same error – Vishali Feb 15 '21 at 06:35
  • You answer is not clear, please clear how to attach Accessibility class to Recording service. – shaby Jun 26 '21 at 06:15