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. Camera

Hello Everyone,

I am new to android and i want develop an application that should run
in background (i know this can we achieved by Service. Am right ?) but
background application need to get the camera usage(duration of
usage , no of clicks ,size of  image taken. etc )  when the foreground
application is camera .

Please kindly help me for how to archive this.

Thanks in advance
--~--~---------~--~----~------------~-------~--~----~

2. Camera Issue

Hi
I am trying to port camera driver and HAL on Samsung Board.
My camera driver uses Samsung Camera Interface FIMC driver
The fimc0,fimc1 and fimc2 are registered and
Following device Nodes are created successfully
/dev/video1 ,/dev/video1 and /dev/video2

My camera driver is registered as subdev for the fimc driver which registers
as a video device to the v4l2 Framework

When i open the camera, My camera driver probe is called but rest of the
v4l2_subdev_core_ops like init is not called since fimc device is busy
s3c-fimc-0 : (0) Clock sclk_fimc(0) enabled.
[ 1699.717696] s3c-fimc-0 : fimc_open: fd.lcd_hres=480 fd.lcd_vres=800
[ 1699.723179] s3c-fimc-0 : s3c-fimc0 opened.
[ 1699.726742] s3c-fimc-0 : fimc_querycap: called
[ 1699.737662] s3c-fimc-0 : fimc_enum_input: index 0
[ 1699.741025] s3c-fimc-0 : fimc_s_input: index 0
[ 1699.751937] My camera Driver loaded.
[ 1699.756052] s3c-fimc-2 : (2) Clock sclk_fimc(2) enabled.
[ 1699.763375] s3c-fimc-2 : fimc_open: fd.lcd_hres=480 fd.lcd_vres=800
[ 1699.778094] s3c-fimc-2 : (2) Clock sclk_fimc(2) disabled.
[ 1699.786897] s3c-fimc-2 : s3c-fimc2 opened.
[ 1699.789655] s3c-fimc-2 : fimc_querycap: called
[ 1699.794110] s3c-fimc-2 : fimc_enum_input: index 0
[ 1699.798763] s3c-fimc-2 : fimc_s_input: index 0
[ 1699.836793] s3c-fimc-0 : fimc_enum_input: index 0
[ 1699.857959] s3c-fimc-1 : Current context is 0
[ 1699.861596] s3c-fimc-1 : (1) Clock sclk_fimc(1) enabled.
[ 1699.872835] s3c-fimc-1 : fimc_open: fd.lcd_hres=480 fd.lcd_vres=800
[ 1699.883535] s3c-fimc-1 : (1) Clock sclk_fimc(1) disabled.
[ 1699.893756] s3c-fimc-1 : s3c-fimc1 opened.
[ 1699.900200] s3c-fimc-1 : fimc_querycap: called
[ 1699.903281] s3c-fimc-1 : fimc_g_fmt_vid_out: called
[ 1700.049894] s3c-fimc-1 : fimc_open: Device busy.
[ 1700.073728] s3c-fimc-1 : fimc_open: Device busy.
[ 1700.099395] s3c-fimc-1 : fimc_open: Device busy.
[ 1700.123148] s3c-fimc-1 : fimc_open: Device busy.


After this fimc_release is called and camera closes!!!
Any inputs on why fimc device is busy....Can anybody explain the flow of how
the Fimc_open fimc_remove gets called


Thanks
Kavitha

-- 

3. Graphics Support

4. Cancel IMEs word prediction from application code?

5. DNS-lookup

6. Problem changing permission with chmod and runtime.getRuntime

7. S3C64XX RT2070L Android2.1 issue