I have a Notification
that is triggered by an AlarmManager
. This is my code:
notification = new NotificationCompat.Builder(getActivity());
AlarmManager alarmManager = (AlarmManager) getActivity().getSystemService(Context.ALARM_SERVICE);
Intent notificationIntent = new Intent("android.media.action.DISPLAY_NOTIFICATION");
notificationIntent.addCategory("android.intent.category.DEFAULT");
PendingIntent broadcast = PendingIntent.getBroadcast(getContext(), 5000, notificationIntent, PendingIntent.FLAG_UPDATE_CURRENT);
alarmManager.setExact(AlarmManager.RTC_WAKEUP, 10000, broadcast);
alarmManager.cancel(broadcast);
// here am trying to cancel the notification with PendingIntent but its not working
EDIT:
by working i meant its not canceling the notification at is supposed to