31.01.2011 11:42, aellis ?????:
I have written a BroadcastReceiver which receives the SMS_RECEIVED intent and unpacks the data, but when I try to create an instance of the TextToSpeech class I get an exception saying that a service can't be started/bound from a BroadcastReceiver. I understand this is because BroadcastReceivers are supposed to be short-running processes.
Right, a broadcast receiver can't *bind* to a service (because receivers are short-lived entities, exiting within the same process).
However, a receiver can *start* a service. Services are started asynchronously, and so doing it won't hold the receiver in its onReceive(). And if you include the sms text as an intent extra when calling startService, then your service will know what to read aloud in its onStart().
-- Kostya -- Kostya Vasilyev -- WiFi Manager + pretty widget -- http://kmansoft.wordpress.com -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/android-developers?hl=en

