I am working on a project to record VOIP calls in android, I didn't found any solution for that, there are lot of apps which support VOIP recordings on phones. I am unable to find any tutorial and help. Cube Call Recorder is one of the app which is giving this feature but I can't figure out how to do it. I was tested it by starting recording by using android MediaRecorder then initiated whatsapp call, so other person was unable to listen my voice. after call, I checked only my voice were saved in the recording.
As a research I reverse engineered some apks, I found they are using Accessibility permissions in the apk.
<uses-permission android:name="android.permission.BIND_ACCESSIBILITY_SERVICE" />
I don't know what things I need to understand how can I get to know that to VOIP call is coming and going just like a BroadcastReceiver.
Then, I will understand how can I record the calls.
I have found the answer for this
First grant accessiblity permission and have this class
import android.accessibilityservice.AccessibilityService;
import android.accessibilityservice.AccessibilityServiceInfo;
import android.content.Intent;
import android.util.Log;
import android.view.accessibility.AccessibilityEvent;
public class AccessAudio extends AccessibilityService {
@Override
public void onAccessibilityEvent(AccessibilityEvent event) {
Log.d("","gf");
}
@Override
protected void onServiceConnected() {
super.onServiceConnected();
AccessibilityServiceInfo accessibilityServiceInfo = new AccessibilityServiceInfo();
accessibilityServiceInfo.flags = 1;
accessibilityServiceInfo.eventTypes = -1;
accessibilityServiceInfo.feedbackType = 16;
setServiceInfo(accessibilityServiceInfo);
}
@Override
public int onStartCommand(Intent intent, int flags, int startId) {
return super.onStartCommand(intent, flags, startId);
}
@Override
public void onInterrupt() {
}
}
After that you can use
mediaRecorder = new MediaRecorder();
mediaRecorder.setAudioSource(MediaRecorder.AudioSource.VOICE_RECOGNITION);
mediaRecorder.setOutputFormat(MediaRecorder.OutputFormat.MPEG_4);
mediaRecorder.setAudioEncoder(MediaRecorder.AudioEncoder.AMR_NB);
mediaRecorder.setOutputFile(AudioSavePathInDevice.getPath());
mediaRecorder.prepare();
mediaRecorder.start();
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With