Alarm Manager - Cancelling all alarms created by application

by Siju Mathew » Sat, 03 Oct 2009 19:14:52 GMT


Sponsored Links
 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

--~--~---------~--~----~------------~-------~--~----~



Other Threads

1. Generate QR Codes

hi,
What's the easiest way to generate and read QR Codes in an android
application?

greets...

-- 

2. LetterRecognizer API in the Gesture class

Hi,

I'm implementing a gesture search feature in my application, I've
noticed that in the Gesture class docs (http://developer.android.com/
reference/android/gesture/Gesture.html) it reads:
"A user-defined gesture can be recognized by a GestureLibrary and a
built-in alphabet gesture can be recognized by a *LetterRecognizer*."

How can I use the LetterRecognizer?
There's no API for that in the docs, I've also searched android's code
itself, and besides the same comment above in the code there's
nothing.

I've implemented a letter recognizer manually by drawing the ABC
letters to a gesture raw file and using the regular
mLibrary.recognize(gesture) API, but the success rate is not very
high, not even close to Google's gesture search app.

Does Google's gesture search uses LetterRecognizer?

Thanks,
Mor.
www.contapps.com

-- 

3. Kernel Crash in Some hardware ,After some cycle

4. Amazon android market. Anyone take the offer?

5. set chlidDivider in ExpandableListView

6. Removing standard package SpeechRecorder in Build

7. How to Benchmark Video Playback performance?