Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android voice recognition through Bluetooth

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.

like image 362
ekawas Avatar asked Nov 24 '25 14:11

ekawas


2 Answers

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 ...

like image 119
ekawas Avatar answered Nov 26 '25 12:11

ekawas


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"/>
like image 20
daleyjem Avatar answered Nov 26 '25 13:11

daleyjem



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!