It seems like you should be tracking exactly which Alarms you have set
as a matter of course, rather than try to find out what is set after
the fact. If you use a unique id for each alarm then you need not be
concerned that you will overwrite one that is in the queue. When I say
unique id, what I mean is the requestCode parameter to the Pending
Intent.
If you change this code
PendingIntent pendingIntent =
PendingIntent.getBroadcast(context, 0, intent, 0);
so that your second parameter is unique for each alarm then you will
not overwrite an existing Alarm.
I hope this helps.
Good luck!
On Sep 8, 7:18 pm, htbest2000 <[email protected]> wrote:
> I guess there is no way to achieve your purpose, except hack the
> AlarmManagerService to export the array list mRtcAlarms, which holds
> all requested RTC alarms.
>
> On Sep 8, 1:34 pm, Walles <[email protected]> wrote:
>
> > Hi!
>
> > How can I probe for whether a specific alarm has been set? I set the
> > alarm as illustrated below, but how can I ask the OS whether or not
> > the below code has been called? The point is not to overwrite an
> > existing alarm with a new one.
>
> > public static void scheduleNextUpdate(Context context, long
> > delay_seconds) {
> > Intent intent = new Intent(context, Updater.class);
> > PendingIntent pendingIntent =
> > PendingIntent.getBroadcast(context, 0, intent, 0);
> > AlarmManager alarmManger =
> > (AlarmManager)context.getSystemService
> > (Context.ALARM_SERVICE);
>
> > long now = System.currentTimeMillis();
> > long later = now + delay_seconds * 1000;
> > Log.d(DrainOMeter.LOGGING_TAG, "Scheduling next update in "
> > + delay_seconds
> > + "s at "
> > + new Date(later));
> > alarmManger.set(AlarmManager.RTC, later, pendingIntent);
> > }
>
> > Full sources available
> > athttp://bazaar.launchpad.net/~walles/drain-o-meter/trunk/annotate/head...
> > if needed.
>
> > Thanks //Johan
>
>
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---