• After 15+ years, we've made a big change: Android Forums is now Early Bird Club. Learn more here.

Java/Android: AlarmManager: cancel an user-defined alarm

E__Man

Lurker
Hello,

I would like to cancel an alarm which was manually defined by the user (for example the next alarm to ring).
I tried:
alarmManager.cancel(alarmManager.getNextAlarmClock().getShowIntent());
But this was ineffective.

If getShowIntent() does not return the PendingIntent which may allow me to cancel the alarm, I don't know how to create one which would.
Normally I should use:
PendingIntent.getBroadcast(context, requestCode, intent, flags);
but I don't know what arguments to give the function.

Could you explain me how to cancel the next programmed alarm knowing it was manually defined by the user (or by another application)?

Sincerely,
E__Man.
 
Back
Top Bottom