Hello folks!
Following situations keeps bugging me, any ideas are welcome!
Working:
+ App is running a service.
+ User presses a headset button.
+ App is starting / voice recognition starts.
Not working:
If i use a bluetooth headset, the sound is still being recorded over the internal microphone.
Someone with the same problem:
http://stackoverflow.com/questions/...oid-recognizerintent-with-a-bluetooth-headset
The Bluetooth headset API seems to have a function named startVoiceRecognition(BluetoothDevice device) [ http://developer.android.com/reference/android/bluetooth/BluetoothHeadset.html ] to start listening though the bluetooth microphone, but i don't know how to use Reflection to call this method.
Following situations keeps bugging me, any ideas are welcome!
Working:
+ App is running a service.
+ User presses a headset button.
+ App is starting / voice recognition starts.
Not working:
If i use a bluetooth headset, the sound is still being recorded over the internal microphone.
Someone with the same problem:
http://stackoverflow.com/questions/...oid-recognizerintent-with-a-bluetooth-headset
The Bluetooth headset API seems to have a function named startVoiceRecognition(BluetoothDevice device) [ http://developer.android.com/reference/android/bluetooth/BluetoothHeadset.html ] to start listening though the bluetooth microphone, but i don't know how to use Reflection to call this method.
B4X:
Sub Process_Globals
Dim Voice As VoiceRecognition
End Sub
Sub Globals
Dim RecognitionDone As Boolean = False
End Sub
Sub Activity_Create(FirstTime As Boolean)
Voice.Initialize("Voice")
'
'If (IsPaused(Events)) Then
' StartService(Events)
'End If
End Sub
Sub Voice_Result(Success As Boolean, Text As List)
If (Success) Then
Dim Lines As String = ""
For i = 0 To Text.Size - 1
Lines = Lines & "|" & Text.Get(i)
Next
'CallSub2(Events, "SendData", Lines)
End If
RecognitionDone = True
End Sub
Sub Activity_Resume
If (RecognitionDone) Then
RecognitionDone = False
Activity.Finish
Else
Voice.Listen
End If
End Sub
Sub Activity_Pause(UserClosed As Boolean)
End Sub