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 at
http://bazaar.launchpad.net/~walles/drain-o-meter/trunk/annotate/head%3A/src/net/launchpad/drainometer/Updater.java#L72
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
-~----------~----~----~----~------~----~------~--~---