Android voice recognition through Bluetooth

谁说我不能喝 提交于 2019-11-30 19:11:41

问题


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"/>


来源:https://stackoverflow.com/questions/8681085/android-voice-recognition-through-bluetooth

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