Phyll wrote:Hi shentongascu,
Regarding the alarms. It seems to me that you would only need one repeating alarm that executes at the resolution of your warnings. In other words, if you have one minute resolution on your warnings it would execute every minute and if there was an alarm set for that minute, it would execute. You could do it for even finer resolution but it would make the processor even more busy.
A more complicated way might be to have a chain of alarms with only the first alarm in the chain using an intent. When that alarm is triggered, it is removed from the chain and makes the intent for the next one.
Just a couple of ideas. Also, a note about alarms, they do not survive a power down. If it is important, you will need to be able to put them back.
Hope this helps.
Phyll
Thanks for your solutions. As you've said, the first way will produce a large burden to the processor, and I have to use a service to deal with this in background. So it seems not a good idea.
For the second one, to tell the truth, I got something confusing. what is an alarm? I mean, the AlarmManager just uses a PendingIntent to define an alarm service and get it linked to a broadcastReceiver to respond the time-up event, and there is no object named alarm. So could you make a explanation for that? please do not mind my asking, I am just a rookie and really want to finish this project.
oh, just add something. For the problem that an alarmservice will not work after the rebooting, I've already know how to do. just define a broadcastReceiver to respond the BOOT_COMPLETED message and rectify the alarm service, make them recovered.
anyway, thanks again