views:

178

answers:

1

Hi,

I am working on an Android service. I need to call RecognizerIntent from a service in order to use in the service the recognized text. I have no startActivityForResult() method in Service class so I have problem understanding how to achieve this task. Is it possible?

Many thanks

+1  A: 

No, I do not believe it is possible. After all, there is no UI from a service, and the RecognizerIntent needs a UI in order to function.

CommonsWare
and trying to call an activity that implements startActivityForResults() that calls, through aidl, the service?
Matroska
Services cannot call `startActivityForResult()`, only activities can.
CommonsWare
yes indeed service will call startActivity() starting an activity that implements startActivityForResult() and then will set information on service through aidl. Could it work?
Matroska
You already have an activity visible on-screen, I hope. Having a service pop up an activity in the middle of the user doing something else is very impolite -- and since your goal is to effectively record their voice, it also raises privacy issues.
CommonsWare