I am trying to add a few commands to android default voicedialer app.
It has commands like Open, dial, call, redial etc, I want to include
lets say 'Find' to it. I have downloaded the source code from here and
compiled it in Eclipse. the application sets up Grammar for arguments
of these commands like it stores the names and phone numbers of the
persons in contact list to generate intents when their names are
recognized for CALL JOHN voice command. For CALL in this command it is
just comparing the first word of resulting recognized string to
"CALL".
I added "FIND" as an extra else if condition in the
onRecognitionSuccess() function as shown below:
public class CommandRecognizerEngine extends RecognizerEngine
{
............
protected void onRecognitionSuccess(RecognizerClient
recognizerClient) throws InterruptedException
{
.....................
if ("DIAL".equalsIgnoreCase(commands[0]))
{
Uri uri = Uri.fromParts("tel", commands[1], null);
String num = formatNumber(commands[1]);
if (num != null)
{
addCallIntent(intents, uri, literal.split(" ")
[0].trim() + " " + num, "", 0);
}
}
................
else if ("FIND".equalsIgnoreCase(commands[0]))
{
if (Config.LOGD)
Log.d(TAG, "FIND detected...");
}
}//end onRecognitionSuccess
}//end CommandRecognizerEngine
but my app can't recognize it.
I also tried adding grammar but I can't add a slot to the grammar,
there is no API for that and mSrecGrammar.addWordToSlot("@Cmmds",
"FIND", null, 1, "V='FIND'"); gives me error coz it doesn't create a
slot.
Does anyone know how does recognizer detects commands like OPEN or
CALL etc or refer me to appropriate documentation?
Thanks.
--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en