Hello,
fist of all happy christmas to all!
I am currently rotating around a little "problem".
I have an App with a service. This service needs reliably start once very 24 hours to do something (time of day is irrelevant just every 24 hours). I selected the StartAtBoot. And in the Main Activity_create I added the line in
If FirstTime AND IsPaused("some_service") Then StartService("some_service")
and in the service_start of the service
StartServiceAt("some_service", DateTime.Now + DateTime.TicksPerday, True)
and then some code.
Problem is now it fires almost every time the main activity is started. This behavior is normal for the app gets killed by the system and is created new.
Now I thought about putting If StartingIntent.ExtrasToString.IndexOf("ALARM_COUNT") = -1 Then Return in the service_start in front of the startserviceat.
My concern is now if for some reason the scheduled service is canceled then the code will never be executed. The question is now: how reliably will the service run every 24 hours if I remove the code from the activity_create? Is it enough to set start at boot and then reschedule the service? Would there not be any way to get a list of scheduled services and just make sure?
Thanks!
Regards
fist of all happy christmas to all!
I am currently rotating around a little "problem".
I have an App with a service. This service needs reliably start once very 24 hours to do something (time of day is irrelevant just every 24 hours). I selected the StartAtBoot. And in the Main Activity_create I added the line in
If FirstTime AND IsPaused("some_service") Then StartService("some_service")
and in the service_start of the service
StartServiceAt("some_service", DateTime.Now + DateTime.TicksPerday, True)
and then some code.
Problem is now it fires almost every time the main activity is started. This behavior is normal for the app gets killed by the system and is created new.
Now I thought about putting If StartingIntent.ExtrasToString.IndexOf("ALARM_COUNT") = -1 Then Return in the service_start in front of the startserviceat.
My concern is now if for some reason the scheduled service is canceled then the code will never be executed. The question is now: how reliably will the service run every 24 hours if I remove the code from the activity_create? Is it enough to set start at boot and then reschedule the service? Would there not be any way to get a list of scheduled services and just make sure?
Thanks!
Regards