Merge pull request #357 from libbybaldwin/libbybaldwin-speechrecognizer-basic

support Android 2.1-2.3.0 and fix up readme js example

Hey @libbybaldwin I actually didn't write this plugin but what you've posted makes sense to incorporate.
This commit is contained in:
macdonst
2012-02-13 06:47:13 -08:00
2 changed files with 3 additions and 3 deletions

View File

@@ -43,7 +43,7 @@ function speechOk(result) {
requestCode = respObj.speechMatches.requestCode;
for (match in respObj.speechMatches.speechMatch) {
console.log("possible match: " + match);
console.log("possible match: " + respObj.speechMatches.speechMatch[match]);
// regex comes in handy for dealing with these match strings
}
}

View File

@@ -57,7 +57,7 @@ public class SpeechRecognizer extends Plugin {
if (!recognizerPresent) {
return new PluginResult(PluginResult.Status.ERROR, NOT_PRESENT_MESSAGE);
}
if (!this.speechRecognizerCallbackId.isEmpty()) {
if (!(this.speechRecognizerCallbackId.length() == 0)) {
return new PluginResult(PluginResult.Status.ERROR, "Speech recognition is in progress.");
}
@@ -125,7 +125,7 @@ public class SpeechRecognizer extends Plugin {
intent.putExtra(RecognizerIntent.EXTRA_LANGUAGE_MODEL, RecognizerIntent.LANGUAGE_MODEL_FREE_FORM);
if (maxMatches > 0)
intent.putExtra(RecognizerIntent.EXTRA_MAX_RESULTS, maxMatches);
if (!prompt.isEmpty())
if (!(prompt.length() == 0))
intent.putExtra(RecognizerIntent.EXTRA_PROMPT, prompt);
ctx.startActivityForResult(this, intent, reqCode);
}