private void setDeleteIntent(NotificationCompat.Builder builder) {
        Intent intent = new Intent(context, ClearReceiver.class)
            .setAction(options.getId().toString())
            .putExtra(Notification.EXTRA_ID, options.getId());

        builder.setDeleteIntent(PendingIntent.getBroadcast(
            context, 0, intent, PendingIntent.FLAG_IMMUTABLE | PendingIntent.FLAG_UPDATE_CURRENT));
    }
Supply a PendingIntent to send when the notification is cleared by the user directly
from the notification panel. For example, this intent is sent when the user clicks the
"Clear all" button, or the individual "X" buttons on notifications.
This intent is not sent when the application calls NotificationManager.cancel(int).
src/android/Notification.java