0

I have an activity which signals a service (IntentService) to do various operations. The Activity might stop running but the service carries on until all data is processed. At various points, the service needs to do a TTS speak. The service cannot do the TTS speak initialization as it is an IntentService and it cannot safely register listeners so another task needs to be written.

My question is, what form should the new task take? It needs to:

  1. Process TTS speak requests from the service
  2. Do TTS.shutdown to release TTS resources when nothing remains to be done
  3. Safely register the TTS onInit listener

The first two requirements indicate the task should have a message handler.

One option I can think of is to use a Thread. I am not sure if a Thread can support a handler and I do not know how the run() method should be handled.

I am relatively new to Android. I have programed a Thread, IntentService and activities in my project, I am unsure where to go with these requirements.

Community
  • 1
  • 1
Bill_NZ
  • 421
  • 4
  • 11

1 Answers1

0

I wrote a bound service that gets messages from the IntentService. It achieves all requirements without a message handler.

Bill_NZ
  • 421
  • 4
  • 11