Hi All,
In my application I create different alarms as reminders, I want to
give a feature to cancel all active alarms. Is there a way to do this
with one call?
I create alarms in the following way:
PendingIntent sender = PendingIntent.getBroadcast(
getApplicationContext(),
uniqueCodeForAlarm, intent,
PendingIntent.FLAG_ONE_SHOT);
uniqueCodeForAlarm - is a unique code I give as reqesterCode so that I
can create a separate alarm each time. If I did not use this, Alarm
Manager cancels previous alarm. Other option I could use is to make my
intent unique, but I think effect is same for the issue that I have.
The only way I know to cancel an alarm is to use the same Intent again
in a call to AlarmManager.cancel(PendingIntent) method. Because I made
my PendingIntent unique (by requesterCode or by making intent unique),
I a forced to cancel each alarm.
The main issue I have is that I do not store the created alarm's
uniqueCodeForAlarm in database/store. I do not want to store the alarm
in database just because I want to cancel it. It will be uch easier to
query the AlarmManager to get all pending alarms created by my
application, or atleast filter the intent.
For example if I can create an Intent with only the Receiver class, it
should cancel all alarms that match the receiver.
Is there any way to cancel all alarms or retrieve all alarms created
by my application?
Regards,
Siju Mathew
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~----------~----~----~----~------~----~------~--~---