Example usage for android.app Notification DEFAULT_LIGHTS

List of usage examples for android.app Notification DEFAULT_LIGHTS

Introduction

In this page you can find the example usage for android.app Notification DEFAULT_LIGHTS.

Prototype

int DEFAULT_LIGHTS

To view the source code for android.app Notification DEFAULT_LIGHTS.

Click Source Link

Document

Use the default notification lights.

Usage

From source file:fr.shywim.antoinedaniel.utils.NotifUtils.java

/**
 * Send a notification to the device. Support for weareable extension.
 *
 * @param id Notification id, must be one of {@link #NOTIFICATION_NEW_VIDEO},
 * {@link #NOTIFICATION_NEW_SOUNDS} or {@link #NOTIFICATION_OTHER}.
 * @param context A {@link android.content.Context}.
 * @param msg Notification's message.//from   w w w  .  j  a va 2  s. c o  m
 * @param ytLink A youtube video id (optionnal).
 */
public static void sendNotification(@NotificationId final int id, final Context context, final String msg,
        @Nullable final String ytLink) {
    new Thread(new Runnable() {
        @Override
        public void run() {
            NotificationManagerCompat notificationManager = NotificationManagerCompat.from(context);

            NotificationCompat.Builder builder = new NotificationCompat.Builder(context)
                    .setSmallIcon(R.drawable.ic_notifs)
                    .setContentTitle(context.getString(R.string.notifications)).setContentText(msg)
                    .setStyle(new NotificationCompat.BigTextStyle().bigText(msg)).setAutoCancel(true);

            switch (id) {
            case NOTIFICATION_NEW_VIDEO:
                builder.setContentTitle("Nouvelle vido !").setContentText(msg);
                break;

            case NOTIFICATION_NEW_SOUNDS:
                builder.setContentTitle("Nouveaux extraits !").setContentText(msg);
                break;

            case NOTIFICATION_OTHER:
                builder.setContentTitle("La Bote  Antoine Daniel").setContentText(msg);
                break;
            }

            builder.setPriority(NotificationCompat.PRIORITY_LOW);
            if (PrefUtils.getNotifSoundEnabled(context)) {
                builder.setSound(Uri.parse(PrefUtils.getNotifRingtone(context)));
            }
            if (PrefUtils.getNotifLightsEnabled(context)) {
                builder.setDefaults(Notification.DEFAULT_LIGHTS);
            }

            Bitmap wearableBitmap;

            PendingIntent contentIntent;
            if (ytLink != null) {
                String bitmapLink = context.getString(R.string.api_get_yt_thmb) + ytLink;

                try {
                    wearableBitmap = Picasso.with(context).load(bitmapLink).resize(400, 400).centerCrop().get();
                } catch (IOException e) {
                    // If we can't download the video image, set the default notification bitmap
                    e.printStackTrace();
                    wearableBitmap = BitmapFactory.decodeResource(context.getResources(),
                            R.drawable.weareable_default_background);
                }

                String url = context.getString(R.string.youtube_link_prefix) + ytLink;
                contentIntent = PendingIntent.getActivity(context, 0,
                        new Intent(Intent.ACTION_VIEW, Uri.parse(url)), 0);
            } else {
                wearableBitmap = BitmapFactory.decodeResource(context.getResources(),
                        R.drawable.weareable_default_background);

                contentIntent = PendingIntent.getActivity(context, 0, new Intent(context, MainActivity.class),
                        0);
            }

            WearableExtender wearableExtender = new WearableExtender().setHintHideIcon(true)
                    .setBackground(wearableBitmap);

            builder.setContentIntent(contentIntent).setLargeIcon(wearableBitmap).extend(wearableExtender);

            notificationManager.notify(id, builder.build());
        }
    }).start();
}

From source file:weekendhacks.com.kahahaibosedk.MyFirebaseMessagingService.java

@Override
public void onMessageReceived(RemoteMessage remoteMessage) {

    // TODO(developer): Handle FCM messages here.
    // Not getting messages here? See why this may be: https://goo.gl/39bRNJ
    NotificationCompat.Builder mBuilder = new NotificationCompat.Builder(this);

    Log.d(TAG, "From: " + remoteMessage.getFrom());

    // Check if message contains a data payload.
    if (remoteMessage.getData().size() > 0) {
        Log.d(TAG, "Message data payload: " + remoteMessage.getData());
    }/*w  w  w.  java2 s  .c  o  m*/

    // Check if message contains a notification payload.
    if (remoteMessage.getNotification() != null) {
        Log.d(TAG, "Message Notification Body: " + remoteMessage.getNotification().getBody());
    }

    mBuilder.setSmallIcon(R.drawable.notification_icon).setContentTitle("From :" + remoteMessage.getFrom());
    if (remoteMessage.getNotification() != null) {
        Log.d(TAG, "Message Notification Body: " + remoteMessage.getNotification().getBody());
        mBuilder.setContentText(remoteMessage.getNotification().getBody());
    }

    mBuilder.setDefaults(
            Notification.DEFAULT_SOUND | Notification.DEFAULT_LIGHTS | Notification.DEFAULT_VIBRATE);
    int mNotificationId = 001;
    NotificationManager mNotifyMgr = (NotificationManager) getSystemService(NOTIFICATION_SERVICE);
    // Builds the notification and issues it.
    mNotifyMgr.notify(mNotificationId, mBuilder.build());
}

From source file:org.cesar.geofencesdemo.managers.NotificationsManager.java

/**
 * This notification it has to be launched when we enter or exit from a
 * location we've sepcified before in the {@link MainActivity}
 * //  w ww .ja  va2 s . c o m
 * @param geofence
 */
public void showLocationReminderNotification(final SimpleGeofence geofence) {

    mNotification = new NotificationCompat.Builder(mContext)
            .setTicker(mContext.getString(R.string.location_reminder_label))
            .setSmallIcon(R.drawable.ic_launcher)
            .setContentTitle(mContext.getString(R.string.location_reminder_label))
            .setContentText(geofence.getAddress()).setOnlyAlertOnce(true).setContentIntent(null).build();

    mNotification.flags = Notification.FLAG_AUTO_CANCEL;
    mNotification.defaults |= Notification.DEFAULT_LIGHTS;
    mNotification.defaults |= Notification.DEFAULT_VIBRATE;
    mNotification.defaults |= Notification.DEFAULT_SOUND;

    // Launch notification
    mNotificationManager.notify(Integer.valueOf(geofence.getPlaceId()), mNotification);
}

From source file:com.parse.ParsePushUnityHelper.java

/**
 * A helper method that provides default behavior for handling ParsePushNotificationReceived.
 *///from w w w. j  ava2s .c  o m
public static void handleParsePushNotificationReceived(Context context, String pushPayloadString) {
    try {
        JSONObject pushData = new JSONObject(pushPayloadString);

        if (pushData == null || (!pushData.has("alert") && !pushData.has("title"))) {
            return;
        }

        ManifestInfo info = new ManifestInfo(context);
        String title = pushData.optString("title", info.getDisplayName());
        String alert = pushData.optString("alert", "Notification received.");
        String tickerText = title + ": " + alert;

        Random random = new Random();
        int contentIntentRequestCode = random.nextInt();

        Intent activityIntent = info.getLauncherIntent();
        PendingIntent pContentIntent = PendingIntent.getActivity(context, contentIntentRequestCode,
                activityIntent, PendingIntent.FLAG_UPDATE_CURRENT);

        NotificationCompat.Builder builder = new NotificationCompat.Builder(context).setContentTitle(title)
                .setContentText(alert).setTicker(tickerText).setSmallIcon(info.getPushIconId())
                .setContentIntent(pContentIntent).setAutoCancel(true).setDefaults(Notification.DEFAULT_ALL);

        Notification notification = builder.build();
        NotificationManager manager = (NotificationManager) context
                .getSystemService(Context.NOTIFICATION_SERVICE);
        int notificationId = (int) System.currentTimeMillis();

        try {
            manager.notify(notificationId, notification);
        } catch (SecurityException se) {
            // Some phones throw exception for unapproved vibration.
            notification.defaults = Notification.DEFAULT_LIGHTS | Notification.DEFAULT_SOUND;
            manager.notify(notificationId, notification);
        }
    } catch (JSONException e) {
        // Do nothing.
    }
}

From source file:org.linphone.compatibility.ApiElevenPlus.java

public static Notification createSimpleNotification(Context context, String title, String text,
        PendingIntent intent) {/*from   w w w.  j av a 2  s.c  om*/
    NotificationCompat.Builder notifBuilder = new NotificationCompat.Builder(context)
            .setSmallIcon(R.mipmap.ic_launcher).setContentTitle(title).setContentText(text)
            .setContentIntent(intent);

    Notification notif = notifBuilder.build();
    notif.defaults |= Notification.DEFAULT_VIBRATE;
    notif.defaults |= Notification.DEFAULT_SOUND;
    notif.defaults |= Notification.DEFAULT_LIGHTS;

    return notif;
}

From source file:uk.co.jarofgreen.cityoutdoors.Service.SendFeatureContentOrReportService.java

protected void onHandleIntent(Intent intent) {

    OurApplication ourApp = (OurApplication) getApplication();

    if (ourApp.hasMoreToUpload()) {
        BaseUploadContentOrReport upload = ourApp.getNextToUpload();

        int featureID = upload.hasFeatureID() ? upload.getFeatureID() : -1;

        // ---------- Start Ongoing Notification
        int icon = R.drawable.notification;
        long when = System.currentTimeMillis();
        Notification notification = new Notification(icon, "Sending", when);

        Intent notificationIntent = new Intent(this, SendFeatureContentOrReportProgressActivity.class);
        PendingIntent contentIntent = PendingIntent.getActivity(this, 0, notificationIntent, 0);

        notification.setLatestEventInfo(getApplicationContext(),
                getString(R.string.send_feature_content_or_report_service_notification_content_title),
                getString(R.string.send_feature_content_or_report_service_notification_content_text),
                contentIntent);/*  w w  w .j av  a  2s.c  o m*/
        notification.flags = Notification.DEFAULT_SOUND;
        notification.flags |= Notification.DEFAULT_VIBRATE;
        notification.flags |= Notification.DEFAULT_LIGHTS;
        notification.flags |= Notification.FLAG_ONGOING_EVENT;

        NotificationManager mNotificationManager = (NotificationManager) getSystemService(
                Context.NOTIFICATION_SERVICE);
        mNotificationManager.notify(SendFeatureContentOrReportService.NOTIFICATION_ID, notification);

        //------------ Send
        if (upload instanceof UploadFeatureContent) {
            sendFeatureContent((UploadFeatureContent) upload);
        } else if (upload instanceof UploadFeatureReport) {
            sendFeatureReport((UploadFeatureReport) upload);
        }

        //----------- Remove from que
        ourApp.removeUploadFromQue(upload);

        // ---------- End Ongoing Notification
        if (!ourApp.hasMoreToUpload()) {
            mNotificationManager.cancel(SendFeatureContentOrReportService.NOTIFICATION_ID);
        }

    }

}

From source file:com.dimasdanz.kendalipintu.util.CommonUtilities.java

public static void generateNotification(Context context, String message, String time, String info) {
    try {//from   ww  w.  j a v  a 2  s.c o  m
        NotificationManager manager;
        int notificationID = 73;

        Bitmap largeIcon = BitmapFactory.decodeResource(context.getResources(),
                R.drawable.ic_stat_notification);

        Notification.Builder builder = new Notification.Builder(context);
        Intent resultIntent = new Intent(context, LogActivity.class);
        TaskStackBuilder stackBuilder = TaskStackBuilder.create(context);

        stackBuilder.addParentStack(LogActivity.class);
        stackBuilder.addNextIntent(resultIntent);

        PendingIntent resultPendingIntent = stackBuilder.getPendingIntent(0, PendingIntent.FLAG_UPDATE_CURRENT);
        Spannable sb = new SpannableString(message + " " + time + "-" + info);
        sb.setSpan(new StyleSpan(android.graphics.Typeface.BOLD), 0, message.length(),
                Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);

        builder.setAutoCancel(true);
        builder.setDefaults(Notification.DEFAULT_LIGHTS | Notification.DEFAULT_SOUND);
        builder.setContentTitle(context.getString(R.string.notification_title));
        builder.setContentText(sb);
        builder.setTicker(context.getString(R.string.notification_ticker));
        builder.setNumber(++msgCounter);
        builder.setSmallIcon(R.drawable.ic_stat_notification);
        builder.setLargeIcon(largeIcon);
        builder.setContentIntent(resultPendingIntent);

        if (msgCounter > 1) {
            Notification.InboxStyle inboxStyle = new Notification.InboxStyle();
            if (msgCounter > 6) {
                name[0] = new SpannableString("...");
                name[1] = name[2];
                name[2] = name[3];
                name[3] = name[4];
                name[4] = name[5];
                name[5] = sb;
            } else {
                name[msgCounter - 1] = sb;
            }

            inboxStyle.setBigContentTitle(context.getString(R.string.notification_title));
            inboxStyle.setSummaryText(
                    msgCounter + " " + context.getString(R.string.notification_title) + " Baru");

            for (int i = name.length; i > 0; i--) {
                inboxStyle.addLine(name[i - 1]);
            }

            builder.setStyle(inboxStyle);
            builder.setContentText(msgCounter + " " + context.getString(R.string.notification_title) + " Baru");
        } else {
            name[0] = sb;
        }
        manager = (NotificationManager) context.getSystemService(Context.NOTIFICATION_SERVICE);
        manager.notify(notificationID, builder.build());
    } catch (NullPointerException e) {
        e.printStackTrace();
    }

}

From source file:com.fn.reunion.app.xmpp.Notifier.java

public void notify(String notificationId, String apiKey, String title, String message, String uri) {
    Log.d(LOGTAG, "notify()...");

    Log.d(LOGTAG, "notificationId=" + notificationId);
    Log.d(LOGTAG, "notificationApiKey=" + apiKey);
    Log.d(LOGTAG, "notificationTitle=" + title);
    Log.d(LOGTAG, "notificationMessage=" + message);
    Log.d(LOGTAG, "notificationUri=" + uri);

    if (isNotificationEnabled()) {
        // Show the toast
        if (isNotificationToastEnabled()) {
            Toast.makeText(context, message, Toast.LENGTH_LONG).show();
        }//from w  ww.  j  av  a  2s.co m

        Notification notification = new Notification();
        notification.icon = getNotificationIcon();
        notification.defaults = Notification.DEFAULT_LIGHTS;

        if (isNotificationSoundEnabled()) {
            notification.defaults |= Notification.DEFAULT_SOUND;
        }

        if (isNotificationVibrateEnabled()) {
            notification.defaults |= Notification.DEFAULT_VIBRATE;
        }

        notification.flags |= Notification.FLAG_AUTO_CANCEL;
        notification.when = System.currentTimeMillis();
        notification.tickerText = message;

        Intent intent = new Intent(context, NotificationDetailsActivity.class);
        intent.putExtra(Constants.NOTIFICATION_ID, notificationId);
        intent.putExtra(Constants.NOTIFICATION_API_KEY, apiKey);
        intent.putExtra(Constants.NOTIFICATION_TITLE, title);
        intent.putExtra(Constants.NOTIFICATION_MESSAGE, message);
        intent.putExtra(Constants.NOTIFICATION_URI, uri);
        intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
        intent.setFlags(Intent.FLAG_ACTIVITY_EXCLUDE_FROM_RECENTS);
        intent.setFlags(Intent.FLAG_ACTIVITY_NO_HISTORY);
        intent.setFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP);
        intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);

        PendingIntent contentIntent = PendingIntent.getActivity(context, 0, intent,
                PendingIntent.FLAG_UPDATE_CURRENT);

        /*      notification.setLatestEventInfo(context, notficationMessage , message , contentIntent);
              notificationManager.notify(Consts.NOTIFICATION_ID, notification);*/

        NotificationCompat.Builder mBuilder = new NotificationCompat.Builder(context)
                .setSmallIcon(getNotificationIcon()).setContentTitle("").setContentText("");

        Notification n = mBuilder.setContentIntent(contentIntent).setSmallIcon(getNotificationIcon())
                .setTicker("").setWhen(System.currentTimeMillis()).setAutoCancel(true).setContentTitle(title)
                .setStyle(new NotificationCompat.BigTextStyle().bigText(message.replaceAll("[\t\n\r]", "\n")))
                .setContentText(message).build();

        if (isNotificationSoundEnabled()) {
            n.defaults |= Notification.DEFAULT_SOUND;
        }

        if (isNotificationVibrateEnabled()) {
            n.defaults |= Notification.DEFAULT_VIBRATE;
        }
        notificationManager.notify(Consts.NOTIFICATION_ID, n);
        // Notification
    } else {
        Log.w(LOGTAG, "Notificaitons disabled.");
    }
}

From source file:com.zion.htf.receiver.AlarmReceiver.java

@Override
public void onReceive(Context context, Intent intent) {
    // Get preferences
    Resources res = context.getResources();
    SharedPreferences pref = PreferenceManager.getDefaultSharedPreferences(context);

    int setId, alarmId;
    try {/*w w w.j av a2s.  c o  m*/
        if (0 == (setId = intent.getIntExtra("set_id", 0)))
            throw new MissingArgumentException("set_id", "int");
        if (0 == (alarmId = intent.getIntExtra("alarm_id", 0)))
            throw new MissingArgumentException("alarm_id", "int");
    } catch (MissingArgumentException e) {
        throw new RuntimeException(e.getMessage());
    }

    // Fetch info about the set
    try {
        // VIBRATE will be added if user did NOT disable notification vibration
        // SOUND won't as it is set even if it is to the default value
        int flags = Notification.DEFAULT_LIGHTS;
        MusicSet set = MusicSet.getById(setId);
        Artist artist = set.getArtist();

        SimpleDateFormat dateFormat;
        if ("fr".equals(Locale.getDefault().getLanguage())) {
            dateFormat = new SimpleDateFormat("HH:mm", Locale.FRANCE);
        } else {
            dateFormat = new SimpleDateFormat("h:mm aa", Locale.ENGLISH);
        }

        // Creates an explicit intent for an Activity in your app
        Intent resultIntent = new Intent(context, ArtistDetailsActivity.class);
        resultIntent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_SINGLE_TOP);// Do not start a  new activity but reuse the existing one (if any)
        resultIntent.putExtra(ArtistDetailsActivity.EXTRA_SET_ID, setId);

        // Manipulate the TaskStack in order to get a good back button behaviour. See http://developer.android.com/guide/topics/ui/notifiers/notifications.html
        TaskStackBuilder stackBuilder = TaskStackBuilder.create(context);
        stackBuilder.addParentStack(ArtistDetailsActivity.class);
        stackBuilder.addNextIntent(resultIntent);
        PendingIntent resultPendingIntent = stackBuilder.getPendingIntent(0, PendingIntent.FLAG_UPDATE_CURRENT);

        // Extract a bitmap from a file to use a large icon
        Bitmap largeIconBitmap = BitmapFactory.decodeResource(context.getResources(),
                artist.getPictureResourceId());

        // Builds the notification
        NotificationCompat.Builder notificationBuilder = new NotificationCompat.Builder(context)
                .setPriority(NotificationCompat.PRIORITY_MAX).setSmallIcon(R.drawable.ic_stat_notify_app_icon)
                .setLargeIcon(largeIconBitmap).setAutoCancel(true).setContentIntent(resultPendingIntent)
                .setContentTitle(artist.getName())
                .setContentText(String.format(context.getString(R.string.alarm_notification), artist.getName(),
                        set.getStage(), dateFormat.format(set.getBeginDate())));

        // Vibrate settings
        Boolean defaultVibrate = true;
        if (!pref.contains(res.getString(R.string.pref_key_notifications_alarms_vibrate))) {
            // Get the system default for the vibrate setting
            AudioManager audioManager = (AudioManager) context.getSystemService(Context.AUDIO_SERVICE);
            if (null != audioManager) {
                switch (audioManager.getRingerMode()) {
                case AudioManager.RINGER_MODE_SILENT:
                    defaultVibrate = false;
                    break;
                case AudioManager.RINGER_MODE_NORMAL:
                case AudioManager.RINGER_MODE_VIBRATE:
                default:
                    defaultVibrate = true;
                }
            }
        }
        Boolean vibrate = pref.getBoolean(res.getString(R.string.pref_key_notifications_alarms_vibrate),
                defaultVibrate);

        // Ringtone settings
        String ringtone = pref.getString(res.getString(R.string.pref_key_notifications_alarms_ringtone),
                Settings.System.DEFAULT_NOTIFICATION_URI.toString());

        // Apply notification settings
        if (!vibrate) {
            notificationBuilder.setVibrate(new long[] { 0l });
        } else {
            flags |= Notification.DEFAULT_VIBRATE;
        }

        notificationBuilder.setSound(Uri.parse(ringtone));

        // Get the stage GPS coordinates
        try {
            Stage stage = Stage.getByName(set.getStage());

            // Add the expandable notification buttons
            PendingIntent directionsButtonPendingIntent = PendingIntent
                    .getActivity(context, 1,
                            new Intent(Intent.ACTION_VIEW,
                                    Uri.parse(String.format(Locale.ENGLISH,
                                            "http://maps.google.com/maps?f=d&daddr=%f,%f", stage.getLatitude(),
                                            stage.getLongitude()))),
                            Intent.FLAG_ACTIVITY_NEW_TASK);
            notificationBuilder.addAction(R.drawable.ic_menu_directions,
                    context.getString(R.string.action_directions), directionsButtonPendingIntent);
        } catch (InconsistentDatabaseException e) {
            // Although this is a serious error, its impact on functionality is minimal.
            // Report this through piwik
            if (BuildConfig.DEBUG)
                e.printStackTrace();
        }

        // Finalize the notification
        notificationBuilder.setDefaults(flags);
        Notification notification = notificationBuilder.build();

        NotificationManager notificationManager = (NotificationManager) context
                .getSystemService(Context.NOTIFICATION_SERVICE);
        notificationManager.notify(set.getStage(), 0, notification);

        SavedAlarm.delete(alarmId);
    } catch (SetNotFoundException e) {
        throw new RuntimeException(e.getMessage());
        // TODO: Notify that an alarm was planned but some error prevented to display it properly. Open AlarmManagerActivity on click
        // Report this through piwik
    }
}

From source file:com.android.systemui.ReminderReceiver.java

@Override
public void onReceive(final Context context, Intent intent) {
    NotificationManager manager = (NotificationManager) context.getSystemService(Context.NOTIFICATION_SERVICE);
    SharedPreferences shared = context.getSharedPreferences(KEY_REMINDER_ACTION, Context.MODE_PRIVATE);

    if (intent.getBooleanExtra("clear", false)) {
        manager.cancel(NOTI_ID);/*  w  w w . j  a v  a2 s.  c om*/
        // User has set a new reminder but didn't clear
        // This notification until now
        if (!shared.getBoolean("updated", false)) {
            shared.edit().putBoolean("scheduled", false).commit();
            shared.edit().putInt("hours", -1).commit();
            shared.edit().putInt("minutes", -1).commit();
            shared.edit().putInt("day", -1).commit();
            shared.edit().putString("title", null).commit();
            shared.edit().putString("message", null).commit();
        }
    } else {
        String title = shared.getString("title", null);
        String message = shared.getString("message", null);
        if (title != null && message != null) {
            Bitmap bm = BitmapFactory.decodeResource(context.getResources(), R.drawable.ic_qs_alarm_on);
            NotificationCompat.Builder builder = new NotificationCompat.Builder(context).setTicker(title)
                    .setContentTitle(title).setContentText(message).setAutoCancel(false).setOngoing(true)
                    .setPriority(NotificationCompat.PRIORITY_HIGH).setSmallIcon(R.drawable.ic_qs_alarm_on)
                    .setLargeIcon(bm).setDefaults(Notification.DEFAULT_LIGHTS | Notification.DEFAULT_VIBRATE)
                    .setStyle(new NotificationCompat.BigTextStyle().bigText(message));

            int alertMode = Settings.System.getIntForUser(context.getContentResolver(),
                    Settings.System.REMINDER_ALERT_NOTIFY, 0, UserHandle.USER_CURRENT);
            PendingIntent result = null;
            Intent serviceIntent = new Intent(context, ReminderService.class);
            if (alertMode != 0 && !QuietHoursHelper.inQuietHours(context, Settings.System.QUIET_HOURS_MUTE)) {
                context.startService(serviceIntent);
            }

            // Stop sound on click
            serviceIntent.putExtra("stopSelf", true);
            result = PendingIntent.getService(context, 1, serviceIntent, PendingIntent.FLAG_CANCEL_CURRENT);
            builder.setContentIntent(result);

            // Add button for dismissal
            serviceIntent.putExtra("dismissNoti", true);
            result = PendingIntent.getService(context, 0, serviceIntent, PendingIntent.FLAG_CANCEL_CURRENT);
            builder.addAction(R.drawable.ic_sysbar_null,
                    context.getResources().getString(R.string.quick_settings_reminder_noti_dismiss), result);

            // Add button for reminding later
            serviceIntent.putExtra("time", true);
            result = PendingIntent.getService(context, 2, serviceIntent, PendingIntent.FLAG_CANCEL_CURRENT);
            builder.addAction(R.drawable.ic_qs_alarm_on,
                    context.getResources().getString(R.string.quick_settings_reminder_noti_later), result);

            shared.edit().putBoolean("scheduled", false).commit();
            shared.edit().putInt("hours", -1).commit();
            shared.edit().putInt("minutes", -1).commit();
            shared.edit().putInt("day", -1).commit();

            manager.notify(NOTI_ID, builder.build());
        }
    }
    shared.edit().putBoolean("updated", false).commit();
}