2

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.

ekawas
  • 6,594
  • 3
  • 27
  • 39

2 Answers2

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"/>
daleyjem
  • 2,335
  • 1
  • 23
  • 34
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 ...

ekawas
  • 6,594
  • 3
  • 27
  • 39
  • is there an example somewhere? How do you get the results after calling startVoiceRecognition()? – Hokascha Jul 03 '12 at 18:29
  • You get the results in exactly the same way as if NO headset was connected. In order to open the mic up on the headset, you call startVoiceRecognition(). It doesn't bring up the dialogue. – ekawas Jul 03 '12 at 20:44