可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试):
问题:
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.
回答1:
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 ...
回答2:
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"/>