#Region Service Attributes
#StartAtBoot: False
#End Region
Sub Process_Globals
Dim TTS2 As TTS
Dim four As Long
End Sub
Sub Service_Create
Log("service created")
If TTS2.IsInitialized = False Then
TTS2.Initialize("TTS2")
End If
TTS2.SetLanguage("en","")
DateTime.TimeFormat = "HH"
Dim s As Int
s = DateTime.Time(DateTime.now)
ToastMessageShow(s,False)
DateTime.TimeFormat = "mm"
Dim s2 As Int
s2 = DateTime.Time(DateTime.now)
Dim now As Long = DateTime.now
four = DateUtils.SetDateAndTime(DateTime.GetYear(now), DateTime.GetMonth(now), _
DateTime.GetDayOfMonth(now),s, s2+2, 0)
If four < now Then
'skip to tomorrow
Dim p As Period
p.Days = 1
four = DateUtils.AddPeriod(four, p)
End If
Log(DateUtils.TicksToString(four))
End Sub
Sub Service_Start (StartingIntent As Intent)
Log("service started")
StartServiceAt("",four,True)
End Sub
Sub Service_Destroy
Log("service destroyed")
TTS2.Release
End Sub
Sub TTS2_Ready (Success As Boolean)
If Success Then
Log("TTS ready!")
DateTime.TimeFormat = "HH:mm"
Dim DateNow, TimeNow As String
DateNow= DateTime.Date(DateTime.Now)
TimeNow = DateTime.Time(DateTime.Now)
Log("Today is " & DateNow & " The time is " & TimeNow)
TTS2.Speak("Today is " & DateNow & " The time is " & TimeNow, True)
Log("spoken")
Else
Log("Error initializing TTS engine.")
End If
End Sub