0

Is it possible to introduce voice recognition in a widget?

My problem is that a widget extends from AppWidgetProvider and I can't use onActivityResult method,so I don't know how to obtain the Intent's result.

Intent voiceIntent = new Intent(RecognizerIntent.ACTION_RECOGNIZE_SPEECH);
voiceIntent.putExtra(RecognizerIntent.EXTRA_LANGUAGE_MODEL, RecognizerIntent.LANGUAGE_MODEL_FREE_FORM);
voiceIntent.putExtra(RecognizerIntent.EXTRA_PROMPT, "Say something");

PendingIntent pendingIntent2 = PendingIntent.getActivity(context, 0, voiceIntent, 0);
RemoteViews views = new RemoteViews(context.getPackageName(), R.layout.voice_widget);
views.setOnClickPendingIntent(R.id.wid, pendingIntent2);

appWidgetManager.updateAppWidget( appWidgetId, views );
  • 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 Apr 30 '14 at 16:46
  • Yes, you can use SpeechRecognizer API and get results with Listener. See http://stackoverflow.com/questions/6316937/how-can-i-use-speech-recognition-without-the-annoying-dialog-in-android-phones – Nikolay Shmyrev Apr 30 '14 at 16:47
  • Do you know where I can find a good tutorial using SpeechRecognizer API? –  May 01 '14 at 03:26

0 Answers0