I am making a medicine reminder app which reminds people to take their medicine on a scheduled date-time.

For example, if my start-date is 08-APR-2013 and the end-date is 12-APR-2013 and time is 11.30 am then the alarm should fire till 12-APR-2013 at 11.30 am. Please help with how I can achieve this. I know how to set an alarm manager and the normal alarm is fired. But when I have a start-date and end-date at that time I become confused about how I should use the alarmManager.setRepeating() method.

有帮助吗?

解决方案

this code for repeating alarm for every day

Date dateobj=new Date(Year,month,day,hour,min);             
setRepeating(AlarmManager.RTC_WAKEUP, dateobj.getTime(), (24*60*60*1000), pendingIntent);

其他提示

you can do this by setting the alarm at the time you want by using the setReapting() method.

1.Use a table to insert your entries.
2.query the table for every minute or for the time interval you want using a broadcast receiver.
3.In the onReceive() callback compare the current time with the insert time and fire the alarm.
4.if there is no record then cancel the pending intent.

if you have any doubt in this go through this link

.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top