tags:

views:

73

answers:

2
+1  Q: 

Editing an alarm !

I am setting an alarm for my reminder app:

PendingIntent sender = PendingIntent.getBroadcast(AddToDoList.this, 
          Integer.parseInt(DBHelperClass.getMaxPrimaryId()), intent, 0);

i am using a unique value (primary ID) to set an alarm. When i want to edit the alarm i am using the same key. But what i see is that both the alarms go off! original as well as edited one.

how do i cancel the old alarm ? Also these alarms are not working once i switchOff & then again switchOn my device .

A: 

Hi,

You should consider changing the way you make Intents unique - requestCode is not officially defined. Try keeping Intent's data different for example.

About persisting the alarm trough reboots, I'm not sure but maybe RTC_WAKEUP flag is the closest you can get.

ognian
A: 

how do i cancel the old alarm ?

Call cancel() with your original PendingIntent.

Also these alarms are not working once i switchOff & then again switchOn my device .

Alarms do not persist after a reboot. You will need to reschedule the alarms, possibly by a BroadcastReceiver that gets control at boot time.

CommonsWare