2013-09-30 92 views
1

我可以接收,挂断和拨打我的headsetandroid mobile的号码,这些号码通过bluetooth连接。如何在Android中通过蓝牙串流来电的音频

现在,当我收到的有前途的移动呼叫的耳机,我需要从耳机被呼叫的人说话。我需要通过蓝牙将我的声音流到Android手机。我正在寻找这个代码。

爬n个职位,但不能得到合适的答案,目前正在使用以下,但其不工作...

AudioManager audioManager; 

audioManager = (AudioManager) getSystemService(AUDIO_SERVICE); 
audioManager.setMode(AudioManager.MODE_IN_COMMUNICATION); 
audioManager.startBluetoothSco(); 
audioManager.setBluetoothScoOn(true); 
audioManager.setSpeakerphoneOn(true); 

我不知道在这之后我需要写要达到什么行代码我的要求

注:我收到崭露头角发送mmOutStream.write("ATA\r".getBytes());这个AT指令到我的Android手机通话。

请纠正和指导我进行音频流。

回答

2

您应该设置扬声器为false,否则你的输出将被重新定向那里。这足以做到这一点:

audioManager.setSpeakerphoneOn(false); 
audioManager.startBluetoothSco(); 
audioManager.setBluetoothScoOn(true); 

此外,您还可以选择设置麦克风非静音状态(以防万一以前的状态是静音):

mAudioManager.setMicrophoneMute(false);