AudioSource.VOICE_CALL not working in android 4.0 but working in android 2.3
Asked Answered
L

4

11
VOICE_CALL, VOICE_DOWNLINK ,VOICE_UPLINK  

not working on android 4.0 but working on android 2.3 (Actual Device),I have uploaded a dummy project to record all outgoing call so that you can see it for your self

http://www.mediafire.com/?img6dg5y9ri5c7rrtcajwc5ycgpo2nf

you just have to change audioSource = MediaRecorder.AudioSource.MIC; to audioSource = MediaRecorder.AudioSource.VOICE_CALL; on line 118 in TService.java

If you come across any error, tell me. Any suggestion related to it will be accepted.

Languid answered 6/2, 2013 at 12:1 Comment(2)
the mediafire file is no longer availableLovellalovelock
Mediafire Invalid or Deleted File.Pyrene
L
16

After a lot of search I Found that Some Manufactures have closed the access to such function because call recording is not allowed in some countries. If anyone finds such question and get the solution some other way then post it over here it may be helpful to many because many people are have the same issue.

Languid answered 9/2, 2013 at 7:32 Comment(16)
thanks a lot. your solution works perfect. I run the project in samsung galaxy s2. I am able to record both the caller and other party's voice. However, the voice of the other party is very low, any particular reason for this problem?Jocelin
the recording is done using mic so the opponents voice is low you just have to change audioSource = MediaRecorder.AudioSource.MIC; to audioSource = MediaRecorder.AudioSource.VOICE_CALL; on line 118 in TService.javaMc
voice call doesn't work in some device so it may throw and exception as stop() failed or start failed -21Mc
yeah, you are right, when i changed audioSource = MediaRecorder.AudioSource.VOICE_CALL, i am getting an exception as soon as i make a phone call. how to solve this problem?Jocelin
Bro it has been a month I am looking for the solution so I posted this question on Stack but no one answeredMc
Remember it will give exception only on that device in which voice call is not supported so catch the exception and start the recording from mic all over again that will keep you on safer side in non supported device .Mc
but how to record outgoing call ? how to detect outgoing call has been recieved and will start recording ?Spindle
When I used MediaRecorder.AudioSource.VOICE_CALL , It give me null pointer exception and Uplink and downlink the voice is not audible after record but in the caase of mic work fine as you said. So, there is any solution for this uplink and downlink ?Fraternal
Unless you root your phone VOICE_CALL, Uplink and downlink will not be available incase of some device ,as per my above answer Manufactures have closed the access to such function ,mic is the only source which will be avaliable for recordingMc
in play store so many apps which allows recording calls. how those apps works well?Trivalent
Hi @AdityaVyas-Lakhan, I have also uploaded my app on play store and that works as well and has thousands of active downloadsMc
in all device it works well? can you give that app link?Trivalent
I made it 4 yrs back and I'm not maintaining it play.google.com/store/apps/…Mc
I am using Samsung Galaxy S8+ and it is not able to record voice using VOICE_CALL, VOICE_UPLINK, VOICE_DOWNLINK except VOICE_MIC and VOICE_RECOGNITION. But if I download apps from the play store then they are able to work in my phone. So, I don't think manufacturer is someone who comes into play here.Sicular
@Sicular test the same code with other devices to make sure its working properly, If other apps are working then your code should work as well.Mc
@Auto-Droidツ I tried using NDK and it is now working fine in my S8+ but the problem is of voice quality. It is very irregular and non uniform. If you can help me then we can have a deal.Sicular
A
1

Try to use MediaRecorder.AudioSource.VOICE_RECOGNITION. I had the same problem - ASUS Transformer uses microphone near the back camera by default and audio is very silent in this case. VOICE_CALL doesn't work on this tablet and I have tried VOICE_RECOGNITION - in that case it uses front microphone and audio volume is OK.

Assessment answered 24/7, 2014 at 8:18 Comment(0)
M
1

OK, in my case this code (thank you eyal!) worked for Samsung Galaxy Note 6:

String manufacturer = Build.MANUFACTURER;
if (manufacturer.toLowerCase().contains("samsung")) {
    recorder.setAudioSource(MediaRecorder.AudioSource.VOICE_COMMUNICATION);
} else {
    recorder.setAudioSource(MediaRecorder.AudioSource.VOICE_CALL);
}
Mahogany answered 13/11, 2017 at 7:4 Comment(1)
Earlier my app was crashing but using this code, it works but didn't record voice from the second endSicular
G
-2

you try to add this,it may be

new Handler().postDelayed(new Runnable() {
    @Override
    public void run() {
        // TODO Auto-generated method stub
        mMediaRecorder.start();
    }
}, 1000);
Grundy answered 23/5, 2016 at 13:52 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.