开发者

Android tts from service

开发者 https://www.devze.com 2023-03-01 16:24 出处:网络
I wrote a little chat client that uses activity and service design fo开发者_运维问答r android.

I wrote a little chat client that uses activity and service design fo开发者_运维问答r android.

The main time the client is running, only the service runs in background and notifys for new messages. Now my problem: The service should speak the incomming message with the help of the internal TTS system, but I have no how to build a "new TextToSpeech()" from the service!

Is there any possibility to create one without having an activity? And if, how?

regards christian


Refer android developers TextToSpeech link Here.

TextToSpeech constructors below.

TextToSpeech(Context context, TextToSpeech.OnInitListener listener)
The constructor for the TextToSpeech class.

sample code refer Here.

0

精彩评论

暂无评论...
验证码 换一张
取 消