Hi Everyone,
Can you look at my coding and let me know how to correct it so I can get the timer to run?
Thanks.
Can you look at my coding and let me know how to correct it so I can get the timer to run?
B4X:
'Service module
Sub Process_Globals
'These global variables will be declared once when the application starts.
'These variables can be accessed from all modules.
Dim pw As PhoneWakeState
Dim tmrTheTimer As Timer
Dim intOneSecond As Int
Dim intOneMinute As Int
Dim intOneHour As Int
End Sub
Sub Service_Create
intOneSecond = 6000
intOneMinute = 60000
intOneHour = 600000
End Sub
Sub Service_Start (StartingIntent As Intent)
ToastMessageShow("Starting timer.", True)
tmrTheTimer.Initialize("TimerHasTicked", .25 * intOneMinute)
tmrTheTimer.Enabled = True
ToastMessageShow("Waking up cpu.", True)
pw.PartialLock
End Sub
Sub Service_Destroy
pw.ReleasePartialLock
End Sub
Sub TimerHasTicked_Tick
ToastMessageShow("Timer Expired", True)
pw.ReleasePartialLock
StartServiceAt("", .5 * intOneMinute, True)
' StartServiceAt("", DateTime.Now + .25 * 60 * 1000, True)
End Sub
Thanks.