Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- onCreate(Bundle savedInstanceState) {
- ...
- NotificationManager nm = (NotificationManager) getSystemService(NOTIFICATION_SERVICE);
- Notification notif = new Notification(R.drawable.flag_red_large, reminderName, System.currentTimeMillis());
- notif.deleteIntent = PendingIntent.getService(this, notifID, new Intent(this, CleanUpIntent.class), 0);
- //Destroy the activity/notification.
- finish();
- }
- class CleanUpIntent extends IntentService {
- public CleanUpIntent() {
- super("CleanUpIntent");
- }
- @Override
- protected void onHandleIntent(Intent arg0) {
- System.out.println(">>>>>>>>>>>>>>>>>>>" + "Repeating Alarm Cancelled...");
- Intent i = new Intent("com.utilityapps.YouForgotWhat.DisplayReminderNotification");
- int reminderID = i.getExtras().getInt("reminderID");
- PendingIntent displayIntent = PendingIntent.getBroadcast(this, reminderID, i, PendingIntent.FLAG_CANCEL_CURRENT);
- AlarmManager alarmManager = (AlarmManager) this.getSystemService(Context.ALARM_SERVICE);
- alarmManager.cancel(displayIntent);
- displayIntent.cancel();
- }
- }
- }
Add Comment
Please, Sign In to add comment