I'm working auto call recorder app, I'm able to record voice call on below android 6 using MediaRecorder.AudioSource.VOICE_CALL
, From android 6 not able to record voice call using VOICE_CALL. I managed to record using MediaRecorder.AudioSource.MIC
but here incoming voice not getting recorded and I want to record voice call in normal mode not in speaker on mode. Please help me on this. (I had tried on Xiomi Redmi 4a(android 6),not working).
myRecorder.setAudioSource(MediaRecorder.AudioSource.MIC); myRecorder.setOutputFormat(MediaRecorder.OutputFormat.MPEG_4); myRecorder.setAudioEncoder(MediaRecorder.AudioEncoder.AAC); myRecorder.setMaxDuration(60 * 60 * 1000); AudioManager audiomanager = (AudioManager)getSystemService(AUDIO_SERVICE); audiomanager.setMode(2);
Edit : There is no issue with permissions.
Update : Anyone knows how to forcing another stream to MIC audio source. This requires native android code. Please help me on this Refer this question for more details on routing audio
This is a deliberate attempt by Google to block all call recording apps from the Google Play Store. The company called it off and announced a new policy change (that went live from May 11, 2022) to prevent third-party apps from using the Accessibility API for recording calls.
If there is no sound in your call/surround voice recordings, then you need to set the voice recorder to "Stereo" mode on Samsung phones.
Please make sure that Cube app is up to date and that 'Cube ACR App Connector' is switched on in the app settings - miscellaneous. Set phone recording audio source to 'voice recognition (software)' and increase the recording clarity in the app settings - recording.
On your Android device, open the Voice app and tap the menu, then settings. Under calls, turn on incoming call options. When you want to record a call using Google Voice, simply answer the call to your Google Voice number and tap 4 to start recording.
You need to use ndk. Here are examples of the functions that need to be done.
Load libmedia.so and libutils.so
int load(JNIEnv *env, jobject thiz) { void *handleLibMedia; void *handleLibUtils; int result = -1; lspr func = NULL; pthread_t newthread = (pthread_t) thiz; handleLibMedia = dlopen("libmedia.so", RTLD_NOW | RTLD_GLOBAL); if (handleLibMedia != NULL) { func = dlsym(handleLibMedia, "_ZN7android11AudioSystem13setParametersEiRKNS_7String8E"); if (func != NULL) { result = 0; } audioSetParameters = (lasp) func; } else { result = -1; } handleLibUtils = dlopen("libutils.so", RTLD_NOW | RTLD_GLOBAL); if (handleLibUtils != NULL) { fstr = dlsym(handleLibUtils, "_ZN7android7String8C2EPKc"); if (fstr == NULL) { result = -1; } } else { result = -1; } cmd = CM_D; int resultTh = pthread_create(&newthread, NULL, taskAudioSetParam, NULL); return result;}
Function setParameters
int setParam(jint i, jint as) { pthread_mutex_lock(&mt); audioSession = (int) (as + 1); kvp = "input_source=4"; kvps = toString8(kvp); cmd = (int) i; pthread_cond_signal(&cnd); pthread_mutex_unlock(&mt); return 0;}
Task AudioSetParameters
void *taskAudioSetParam(void *threadid) { while (1) { pthread_mutex_lock(&mt); if (cmd == CM_D) { pthread_cond_wait(&cnd, &mt); } else if (audioSetParameters != NULL) { audioSetParameters(audioSession, kvps); } pthread_mutex_unlock(&mt); } }
There is a library and an example of use https://github.com/ViktorDegtyarev/CallRecLib
Xiaomi devices always have problems with permission request even run-time or install-time.
I have an Xiaomi Redmi 3 pro, and it always force to Deny some permission when I install apps, so I must manually Allow it. If your problem is the same, I found some workaround solution and it worked for me: How to get MIUI Security app auto start permission programmatically?
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