-1

I want to use startActivityForResult to start a RecognizerIntent in Android, but without the dialog window, to basically keep the UI in the front from which the activity is launched (the background with 'Session' in the screenshot below).

When I use startActivityForResult(audioIntent,1) to start my speech recognition in Android, a dialog of the RecognizerIntent shows up like the screenshot below:

Intent intent = new Intent(RecognizerIntent.ACTION_RECOGNIZE_SPEECH);
intent.putExtra(RecognizerIntent.EXTRA_LANGUAGE_MODEL,
                      RecognizerIntent.LANGUAGE_MODEL_WEB_SEARCH);
if (!intent.hasExtra(RecognizerIntent.EXTRA_CALLING_PACKAGE))
{
    intent.putExtra(RecognizerIntent.EXTRA_CALLING_PACKAGE,
            "com.dummy");
}
startActivityForResult(intent,1);

I am aware that I could use the SpeechRecognizer class which doesn't have a dialogue, but it doesn't have all the capabilities that I need. Is there any way to use RecognizerIntent startActivityForResult without a visible dialog? All the other similar questions on SO use SpeechRecognizer, which I want to avoid.

enter image description here

  • 2
    *Is there any way to use startActivityForResult without the popup?* If by *without the popup* you mean without showing Activity, then obviosuly: **no** – Selvin Nov 03 '16 at 14:42
  • I mean the overlay that says "Speak Now", is there any way to disable that? –  Nov 03 '16 at 14:45
  • Possible duplicate of [How can I use speech recognition without the annoying dialog in android phones](http://stackoverflow.com/questions/6316937/how-can-i-use-speech-recognition-without-the-annoying-dialog-in-android-phones) – Nikolay Shmyrev Nov 03 '16 at 21:56
  • No, its not a duplicate. Your link suggests the use of SpeechRecognizer, which I want to avoid. –  Nov 03 '16 at 22:25
  • 2
    What capabilities does the `SpeechRecognizer` lack? – brandall Nov 04 '16 at 10:03
  • 2
    it doesn't allow to transcribe and capture audio simultaneously. –  Nov 04 '16 at 14:49

1 Answers1

1

Unless startActivityForResult(audioIntent,1) has options to disable the popup, no. It's an activity that someone else has written. The way you want it, you will need to write your own activity with (probably) google's speech recognition plugged into that. Good luck & have fun!

  • So by that you mean the RecognizerIntent needs to be overwritten? –  Nov 03 '16 at 14:48
  • 2
    No, you are starting an activity you did not write, so probably don't have the source code for. You want to start an activity that does exactly what you want it to do. Only way is to write is yourself. Unless you can find some thing that you can reuse. – Flummox - don't be evil SE Nov 03 '16 at 14:51
  • Is there another way to start the activity that is already implementet but without the UI, like embedding it in a Service or similar? –  Nov 03 '16 at 14:52
  • 1
    Not that I know, you will have to dig into the documentation. I hope for you that you can import the classes / things you need. – Flummox - don't be evil SE Nov 03 '16 at 14:59