Hello!
I start and stop the following service with Startservice(TTSService) and Stopservice(TTSService) in the main sub, when a checkbox is true. But after stopping, the service starts always again
Then i have tried it with a timer in the service. That runs for a few minutes, but then the service stops with an error. Should the timer be the problem?
Thanks for help....
I start and stop the following service with Startservice(TTSService) and Stopservice(TTSService) in the main sub, when a checkbox is true. But after stopping, the service starts always again
B4X:
'Service module
Sub Process_Globals
Dim TTS1 As TTS
Dim TTSReady as boolean
End Sub
Sub Service_Create
TTSReady=false
If TTS1.IsInitialized = False Then
TTS1.Initialize("TTS1")
End If
TTS_Settings
End Sub
Sub Service_Start
StartServiceAt("", DateTime.Now + 7*DateTime.TicksPerSecond, True)
if TTSReady then TTS1.Speak("This is my Text",True)
End Sub
Sub Service_Destroy
TTS1.Release
End Sub
Sub TTS_Settings
TTS1.SpeechRate = 1.5
TTS1.Pitch = 1.5
TTS1.SetLanguage("de","")
End Sub
Sub TTS1_Ready (Success As Boolean)
If Success Then TTSReady=True
End Sub
Then i have tried it with a timer in the service. That runs for a few minutes, but then the service stops with an error. Should the timer be the problem?
B4X:
Sub Service_Create
TimerTTS.Initialize("TimerTTS",7000)
If TTS1.IsInitialized = False Then
TTS1.Initialize("TTS1")
End If
TTS_Settings
End Sub
Sub TTS1_Ready (Success As Boolean)
If Success Then TimerTTS.Enabled=True
End Sub
Sub TimerTTS_Tick
TTS1.Speak("This is my Text",True)
end sub
Thanks for help....