I'm developing an augmentative communication application for use on Kindle Fire. I'm using Fire HD 6 as my test device. I'm working in Xamarin, C#.
I know there is a speech recognizer on the device as the microphone icon appears on the keyboard and I can use it to populate the search window. However, my andoid speech recognizer code is not working. I get the "recognizer not present" error. Here is the code that I'm working with:
public class VoiceRecognition : Activity
{
private static String TAG = "VoiceRecognition";
private const int VOICE_RECOGNITION_REQUEST_CODE = 1234;
private ListView mList;
public Handler mHandler;
private Spinner mSupportedLanguageView;
protected override void OnCreate(Bundle savedInstanceState)
{
base.OnCreate(savedInstanceState);
mHandler = new Handler();
SetContentView(Resource.Layout.Main);
Button speakButton = FindViewById<Button>(Resource.Id.btnRecord);
// Check to see if a recognition activity is present
PackageManager pm = PackageManager;
IList<ResolveInfo> activities = pm.QueryIntentActivities(new Intent(RecognizerIntent.ActionRecognizeSpeech), 0);
if (activities.Count != 0)
speakButton.Click += speakButton_Click;
else
{
speakButton.Enabled = false;
speakButton.Text = "Recognizer not present";
}
}
This code is obviously not going to work, but I don't know where to go from here. How can I access the voice recognizer on this device?
Thanks!
You could try to connect to the speech recognizer via SpeechRecognizer (most keyboard apps do that).
Another thing to try is another action when you call the RecognizerIntent activity, e.g. there is also ACTION_WEB_SEARCH.