I have a Service that I start from Activity(Main).
The Service(Schedule) is to perform a function ever XX minutes.
In the following example, I have set XX minutes = 1.
In the final app I will set XX minutes = 30.
Sub Service_Start (StartingIntent As Intent)
Log("shedule.service_start()")
Log("I´m started. So I´ll do my job NOW and reshedule me for the next time")
' This is where I perform a function. (CallSub(Main, "XXXXXX")
Dim MyDateTime As Long
MyDateTime = DateTime.Now
Log($"Now time is: $Time{MyDateTime}"$)
Dim NextTime As Long = (MyDateTime +( 1 * DateTime.TicksPerMinute)) ' 1 minutes interval
Log($"Next time is: $Time{NextTime}"$)
StartServiceAt(Me,NextTime,True)
End Sub
However, the time (NextTime) is not accurate.
I seem to have a problem setting the NextTime.
The Log:
** Service (starter) Create **
** Service (starter) Start **
** Activity (main) Create, isFirst = true **
** Activity (main) Resume **
** Service (schedule) Create **
** Service (schedule) Start **
shedule.service_start()
I´m started. So I´ll do my job NOW and reshedule me for the next time
Now time is: 10:46:08
Next time is: 10:47:08
** Service (schedule) Start **
shedule.service_start()
I´m started. So I´ll do my job NOW and reshedule me for the next time
Now time is: 10:47:49
Next time is: 10:48:49
** Service (schedule) Start **
shedule.service_start()
I´m started. So I´ll do my job NOW and reshedule me for the next time
Now time is: 10:49:32
Next time is: 10:50:32
** Service (schedule) Start **
shedule.service_start()
I´m started. So I´ll do my job NOW and reshedule me for the next time
Now time is: 10:51:13
Next time is: 10:52:13
** Service (schedule) Start **
shedule.service_start()
I´m started. So I´ll do my job NOW and reshedule me for the next time
Now time is: 10:52:56
Next time is: 10:53:56