4

I have an Android application that uses speech recognition in an Activity. The GUI doesn't do anything except for contain the speech recognition objects. I would like to port this over to a service so I can talk to the application while it's running in the background.

However, as far as I know, the speech recognition service has to use onActivityResult, which is unavailable for Services. Is there a way to either contain an Activity in a Service such that its GUI is not displayed, or perform speech recognition in a service instead of an activity?

Zach Rattner
  • 20,745
  • 9
  • 59
  • 82

2 Answers2

2

See Google's voice search speech recognition service - it might have some useful links to information. I don't think you can do non-Gui voice recognition because the recognizer is only exposed as the recognizer intent.

I don't think that Google wants people to call this service directly, and it likely violates some terms of service somewhere if you do, but check out http://mikepultz.com/2011/03/accessing-google-speech-api-chrome-11/ to see the service behind Chrome speech recognition which I suspect is similar to Android.

Community
  • 1
  • 1
Michael Levy
  • 13,097
  • 15
  • 66
  • 100
  • @ZachRattner So have you got any clues or direction , If we can do this in background and continue listening to voice it via service. – AAnkit Dec 03 '12 at 19:44
  • this is an old answer. You might want to look at http://stackoverflow.com/questions/11913704/comparison-of-speech-recognition-use-in-android-by-intent-or-on-thread – Michael Levy Dec 03 '12 at 22:09
1

what if you have your service wake up an activity when it detects any incoming audio signal,

that acts like a widget only taking up a small part of the screen or even just a single pixel, then call voice recognition from the invisible activity?

Just an idea, I don't remember if a widget can be an activity or if you can make an activity that doesn't take up the screen.

Tsais
  • 301
  • 1
  • 3
  • 7