Not getting RecognizerIntent result codes

by pac » Fri, 23 Apr 2010 01:18:44 GMT

Sponsored Links
 I want to get the RecognizerIntent result codes such as
RESULT_SERVER_ERROR because I want to distinguish between the cases
where the speech wasn't understood or no matches were found and the
cases where recognition didn't occur because of connection or server

When onActivityResult() executes, however, the result code is either
RESULT_OK or 0.  I never catch any of the various RecognizerIntent
result codes.  What do I need to do?

Here's my code:

  private void startVoiceRecognitionActivity() {
        Intent intent= new
        intent.putExtra(RecognizerIntent.EXTRA_PROMPT, "Say something!");
        startActivityForResult(intent, VOICE_RECOGNITION_REQUEST_CODE);

    protected void onActivityResult(int requestCode, int resultCode,
Intent data) {
        if (requestCode == VOICE_RECOGNITION_REQUEST_CODE &&
resultCode == RESULT_OK) {
              // do stuff
        else if (requestCode == VOICE_RECOGNITION_REQUEST_CODE &&
resultCode != RESULT_OK) {

                // Figure out the error
                String err = "";
                switch (resultCode) {
                case (RecognizerIntent.RESULT_AUDIO_ERROR):
                        err = "Audio error";
                case (RecognizerIntent.RESULT_CLIENT_ERROR):
                        err = "Client error";
                case (RecognizerIntent.RESULT_NETWORK_ERROR):
                        err = "Network error";
                case (RecognizerIntent.RESULT_NO_MATCH):
                        err = "No match";
                case (RecognizerIntent.RESULT_SERVER_ERROR):
                        err = "Server error";
        super.onActivityResult(requestCode, resultCode, data);


Other Threads

1. Multiple Services within a Process

This is probably a question for Dianne:

The Android 2.0 SDK introduces the startForeground() API which makes
it much less likely that a background service (and therefore a given
process) will be killed.

Suppose there are two services within a process, and one of those
services has called startForeground() while the other has not.  Will
the one foreground service "protect" the other non-foreground service
from being killed?

I'm specifically looking at a case where there could be multiple
services within a process, but coming from different APKs.  So these
would be APKs signed with the same signature, and given the same
sharedUserID and process in the Android Manifest.  I'd like to avoid
having to post a notification for each individual service, as that
would likely annoy users.



2. strace


I want to trace the system calls (using strace) made by Android
Applications. I can do it using terminal emulator or adb shell.

I wrote a simple Hello World app in C and the Cross-Compile it and adb
push it into /data and I could use strace.

But how to use strace on the Android Applications installed in the
menu? Must I write a module or an app to do it?

Thanks in Advance,


3. Mohon bantuan setting manual

4. Simple Call App

5. Simple Call App - Uri?


7. best way to store last calculations