These following lines of code will surely help you remove / cancel pending intent and alarm.
The main thing you need:
- Create a pending intent with the same identifier and corresponding FLAG planning.
- Cancel this pending intention.
Cancel the alarm using the alarm manager.
Intent myIntent = new Intent(PresentActivity.this, AlarmActivity.class);
pendingIntent = PendingIntent.getActivity(PresentActivity.this,pending_intent_unique_id, myIntent,PendingIntent.FLAG_UPDATE_CURRENT);
pendingIntent.cancel();
alarmManager.cancel(pendingIntent);
Happy coding !!
source
share