Code below creates an Alarm, so far everything is working fine.
But i am a bit lost in the Documentaion how to cancel an Alarm.
I need to cancel only special Alarm(s) depending on
Intent#putExtra(IntentConstants.SELECTED_PRIMARY_KEY,_selectedID);
How can i archive this ?
public static void createRetryAlarm(final int _selectedID, final
Context _context)
{
if (Logging.isLoggingEnabled())
{
Log.d(LOG_TAG, "Creating retry alarm for selected with
id :" +
_selectedID);
}
final long now = System.currentTimeMillis();
//
final Intent intent = new Intent(_context,
AlarmBroadcastReciever.class);
intent.putExtra(IntentConstants.SELECTED_PRIMARY_KEY,
_selectedID);
final int requestID = alarmCounter.incrementAndGet();
final PendingIntent pendingIntent =
PendingIntent.getBroadcast(_context, requestID, intent,
PendingIntent.FLAG_ONE_SHOT);
final AlarmManager alarmManager = (AlarmManager)
_context.getSystemService(Context.ALARM_SERVICE);
alarmManager.set(AlarmManager.RTC_WAKEUP, now +
(AlarmManager.INTERVAL_HALF_HOUR), pendingIntent);
}
Many Thanks,
Jens
--
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