AudioSource.VOICE_CALL not working in android 4.0 but working in android 2.3

僤鯓⒐⒋嵵緔 提交于 2019-11-27 12:54:59

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. 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.

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

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);
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!