通过蓝牙进行安卓语音识别[英] Android voice recognition through Bluetooth

本文是小编为大家收集整理的关于通过蓝牙进行安卓语音识别的处理/解决方法,可以参考本文帮助大家快速定位并解决问题,中文翻译不准确的可切换到English标签页查看源文。

问题描述

我在我的活动中使用语音识别,我刚刚意识到,如果我有一个耳机,识别器仍然只侦听手机麦克风.有没有办法通过耳机倾听?

我注意到了这一点: 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"/>

本文地址:https://www.itbaoku.cn/post/102359.html

问题描述

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