Kicking off a service module

rfresh

Well-Known Member
Licensed User
Longtime User
Is it possible to kick off (start) a service module on the hour?

I'm using this code below now but can't figure out how to kick it off at the top of each hour (or on a specific min of each hour).

B4X:
StartServiceAt("",DateTime.Now + 900 * 1000,True)'15 mins

Thanks...
 

Jack Cole

Well-Known Member
Licensed User
Longtime User
To start at the top of the next hour:

B4X:
if DateTime.GetHour(DateTime.Now)<23 then
runtime=DateTime.DateParse(DateTime.Date(DateTime.Now) & " 00:00:00")+(DateTime.GetHour(DateTime.Now)+1) * 3600 * 1000
else
runtime=DateTime.DateParse(DateTime.Date(DateTime.Now+DateTime.TicksPerDay) & " 00:00:00")
end if
StartServiceAt("",runtime,True)

I haven't tested this, but I think it should be pretty close to what you want.
 
Upvote 0

rfresh

Well-Known Member
Licensed User
Longtime User
Gosh...I can't follow what the code is doing...can you explain it a bit? Thanks so much...
 
Upvote 0
Top