mirror of
https://github.com/purplecabbage/phonegap-plugins.git
synced 2026-04-24 03:00:11 -04:00
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:
@@ -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
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user