Hi...
I used "StartServiceAt" and "StartServiceAtExact" for starting Alarm Service on a specific time. but the problem, some times the alarm start at the exact time , and other times delay from 1 to 5 minuts and sometimes before seconds from the selected time.
This a part from the code I used :
B4A : 6.8
Thank you ....
I used "StartServiceAt" and "StartServiceAtExact" for starting Alarm Service on a specific time. but the problem, some times the alarm start at the exact time , and other times delay from 1 to 5 minuts and sometimes before seconds from the selected time.
This a part from the code I used :
B4X:
Sub StartAlarm
Dim hours As Int = 1 ' just for testing
Dim mins As Int = 15 ' just for testing
Dim alarm As Long = DateTime.DateParse(DateTime.Date(DateTime.Now) + (hours * DateTime.TicksPerHour + mins * DateTime.TicksPerMinute))
If alarm < DateTime.Now Then alarm = DateTime.Add(alarm, 0, 0, 1)
Dim h As Int = Floor((alarm - DateTime.Now) / DateTime.TicksPerHour)
Dim m As Int = ((alarm - DateTime.Now) - h * DateTime.TicksPerHour) / DateTime.TicksPerMinute
StartServiceAt("AlarmService", (DateTime.Now+((h*60*60*1000)+(m*60*1000))), True)
'StartServiceAtExact("AlarmService", (DateTime.Now+((h*60*60*1000)+(m*60*1000))), True)
End Sub
B4A : 6.8
Thank you ....