Just call this alarm.cancel()
with the same pendingIntent
you've used to start it at the onDestroy
method of Activity/Fragment:
AlarmManager alarm = (AlarmManager) getSystemService(Context.ALARM_SERVICE);
alarm.cancel(pendingIntent)
From the description of cancel()
method:
Remove any alarms with a matching Intent
. Any alarm, of any type, whose Intent
matches this one (as defined by filterEquals(Intent)
), will be canceled.