问题描述
我在我的活动中使用语音识别,我刚刚意识到,如果我有一个耳机,识别器仍然只侦听手机麦克风.有没有办法通过耳机倾听?
我注意到了这一点: http://developer.android.com/reference/android/bluetooth/bluettootheadets.html ,但大多数方法都不可用,直到蜂窝...
谢谢.
推荐答案
基本上,这只能使用蓝牙头部设置...
在我的语音识别活动中,我首先调用此方法: startvoicerecognition()然后继续正常.
当我完成时,我会致电 stopvoicerecognition().它实际上似乎很好地工作.
只有问题是它不适用于API级别<11 ...其他推荐答案
您可以使用:
audioManager.startBluetoothSco();
确保将以下内容添加到您的清单中:
<uses-permission android:name="android.permission.RECORD_AUDIO" /> <uses-permission android:name="android.permission.BLUETOOTH" /> <uses-permission android:name="android.permission.MODIFY_AUDIO_SETTINGS"/>
问题描述
I am using voice recognition in my activity and I just realized that if I have a headset connected, the recognizer still only listens through the phone mic. Is there any way to make it listen through the headset?
I did notice this: http://developer.android.com/reference/android/bluetooth/BluetoothHeadset.html but most of the methods are not available until HoneyComb ...
Thanks.
推荐答案
Basically, this can only be done using the BluetoothHeadset class...
In my voice recognition activity, I call this method first: startVoiceRecognition() then proceed as normal.
When I am done, I then call stopVoiceRecognition(). It actually appears to work nicely.
Only issue is that it doesn't work on API levels <11 ...
其他推荐答案
You can use:
audioManager.startBluetoothSco();
Make sure the following are added to your manifest:
<uses-permission android:name="android.permission.RECORD_AUDIO" /> <uses-permission android:name="android.permission.BLUETOOTH" /> <uses-permission android:name="android.permission.MODIFY_AUDIO_SETTINGS"/>