@Override protected void onHandleIntent(Intent intent) { String action = intent.getAction(); String taskID = intent.getExtras().getString("data", ""); Integer notificationId = Common.isNull(intent.getExtras().getInt("notificationId"), 0); NotificationManager mNotifyMgr = (NotificationManager) MyApplication.getCurrentActivity().getSystemService(NOTIFICATION_SERVICE); // This section handles the 3 possible actions: // ping, snooze, and dismiss. if (!taskID.equals("")) { if (action.equals(Common.ACTION_NEW)) { MyApplication.getDataProvider().setTaskCreated(taskID); if (notificationId > 0) mNotifyMgr.cancel(notificationId); } else if (action.equals(Common.ACTION_TAKED)) { MyApplication.getDataProvider().setTaskTaked(taskID); if (notificationId > 0) mNotifyMgr.cancel(notificationId); } else if (action.equals(Common.ACTION_COMPLETED)) { MyApplication.getDataProvider().setTaskCompleted(taskID); if (notificationId > 0) mNotifyMgr.cancel(notificationId); } } }