I want to make a calendar with alarm.
For one alarm to sound within x time no problem, but if I put an alarm for x time and this calls the service and put another alarm for x + y time and this calls the service? the second overrides the first? Must i create separate services for each alarm? can create unlimited services in run time? or should I create a limited number of services for each alarm you want to include in the program?
Thank you.
What you need to do is to start the service at the 'nearest' time, and when that is run, reschedule it for the next nearest time.
You only need one service.
i start service since 5 minutes for example (elapsedtotal= 5 minutes) .thats ok.
but if i put again another alarm in 10 minutes (elapsedtotal=10 minutes) i call again to starserviceat(......) then sound at 5 minutes and 10 minutes?
It's a matter of how your code handles the upcoming events.
Suppose you have a list of events. Then, when your service starts to perform the 'alarm', you can take this alarm out of your list. Then take the next one, and find the time interval between the current executed alarm and that one. This way, execute a startServiceAt again, using this interval.