AudioSource.VOICE_CALL not working in android 4.0

2019-01-11 04:47发布

问题:

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.

回答1:

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.



回答2:

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.



回答3:

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);
}


回答4:

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);