简体   繁体   English

AudioSource.VOICE_CALL在android 4.0中无效,但在android 2.3中工作

[英]AudioSource.VOICE_CALL not working in android 4.0 but working in android 2.3

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 我没有在Android 4.0上工作但是在Android 2.3(实际设备)上工作,我已经上传了一个虚拟项目来记录所有拨出电话,这样你就可以看到它为你自己

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

you just have to change audioSource = MediaRecorder.AudioSource.MIC; 你只需要改变audioSource = MediaRecorder.AudioSource.MIC; to audioSource = MediaRecorder.AudioSource.VOICE_CALL; audioSource = MediaRecorder.AudioSource.VOICE_CALL; on line 118 in TService.java TService.java第118 TService.java

If you come across any error, tell me. 如果您遇到任何错误,请告诉我。 Any suggestion related to it will be accepted. 任何与之相关的建议都将被接受。

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. 如果有人发现这样的问题并以其他方式获得解决方案然后在这里发布它可能对许多人有帮助,因为很多人都有同样的问题。

Try to use MediaRecorder.AudioSource.VOICE_RECOGNITION . 尝试使用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. 我有同样的问题 - 华硕Transformer默认使用后置摄像头附近的麦克风,在这种情况下音频非常安静。 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. VOICE_CALL无法在这款平板电脑上运行,我尝试过VOICE_RECOGNITION - 在这种情况下,它使用前置麦克风,音频音量正常。

OK, in my case this code (thank you eyal !) worked for Samsung Galaxy Note 6: OK,在我的情况下, 该代码 (感谢你的Eyal !)工作了三星Galaxy注6:

String manufacturer = Build.MANUFACTURER;
if (manufacturer.toLowerCase().contains("samsung")) {
    recorder.setAudioSource(MediaRecorder.AudioSource.VOICE_COMMUNICATION);
} else {
    recorder.setAudioSource(MediaRecorder.AudioSource.VOICE_CALL);
}

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM