Example usage for android.app Notification FLAG_AUTO_CANCEL

List of usage examples for android.app Notification FLAG_AUTO_CANCEL

Introduction

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

Prototype

int FLAG_AUTO_CANCEL

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

Click Source Link

Document

Bit to be bitwise-ored into the #flags field that should be set if the notification should be canceled when it is clicked by the user.

Usage

From source file:org.acra.ErrorReporter.java

/**
 * Creates a status bar notification./*from   ww  w. j a  va  2 s.  c  om*/
 *
 * The action triggered when the notification is selected is to start the
 * {@link CrashReportDialog} Activity.
 *
 * @param reportFileName Name of the report file to send.
 */
private void createNotification(String reportFileName, ReportBuilder reportBuilder) {

    final NotificationManager notificationManager = (NotificationManager) mContext
            .getSystemService(Context.NOTIFICATION_SERVICE);

    final ReportsCrashes conf = ACRA.getConfig();

    // Default notification icon is the warning symbol
    final int icon = conf.resNotifIcon();

    final CharSequence tickerText = mContext.getText(conf.resNotifTickerText());
    final long when = System.currentTimeMillis();

    ACRA.log.d(LOG_TAG, "Creating Notification for " + reportFileName);
    final Intent crashReportDialogIntent = createCrashReportDialogIntent(reportFileName, reportBuilder);
    final PendingIntent contentIntent = PendingIntent.getActivity(mContext, mNotificationCounter++,
            crashReportDialogIntent, PendingIntent.FLAG_UPDATE_CURRENT);

    final CharSequence contentTitle = mContext.getText(conf.resNotifTitle());
    final CharSequence contentText = mContext.getText(conf.resNotifText());

    final NotificationCompat.Builder builder = new NotificationCompat.Builder(mContext);
    final Notification notification = builder.setSmallIcon(icon).setTicker(tickerText).setWhen(when)
            .setAutoCancel(true).setContentTitle(contentTitle).setContentText(contentText)
            .setContentIntent(contentIntent).build();

    notification.flags = notification.flags | Notification.FLAG_AUTO_CANCEL;

    // The deleteIntent is invoked when the user swipes away the Notification.
    // In this case we invoke the CrashReportDialog with EXTRA_FORCE_CANCEL==true
    // which will cause BaseCrashReportDialog to clear the crash report and finish itself.
    final Intent deleteIntent = createCrashReportDialogIntent(reportFileName, reportBuilder);
    deleteIntent.putExtra(ACRAConstants.EXTRA_FORCE_CANCEL, true);
    notification.deleteIntent = PendingIntent.getActivity(mContext, -1, deleteIntent, 0);

    // Send new notification
    notificationManager.notify(ACRAConstants.NOTIF_CRASH_ID, notification);
}

From source file:com.mozilla.SUTAgentAndroid.service.DoCommand.java

private void SendNotification(String tickerText, String expandedText) {
    NotificationManager notificationManager = (NotificationManager) contextWrapper
            .getSystemService(Context.NOTIFICATION_SERVICE);
    int icon = R.drawable.ateamlogo;
    long when = System.currentTimeMillis();

    Notification notification = new Notification(icon, tickerText, when);

    notification.flags |= (Notification.FLAG_INSISTENT | Notification.FLAG_AUTO_CANCEL);
    notification.defaults |= Notification.DEFAULT_SOUND;
    notification.defaults |= Notification.DEFAULT_VIBRATE;
    notification.defaults |= Notification.DEFAULT_LIGHTS;

    Context context = contextWrapper.getApplicationContext();

    // Intent to launch an activity when the extended text is clicked
    Intent intent2 = new Intent(contextWrapper, SUTAgentAndroid.class);
    PendingIntent launchIntent = PendingIntent.getActivity(context, 0, intent2, 0);

    notification.setLatestEventInfo(context, tickerText, expandedText, launchIntent);

    notificationManager.notify(1959, notification);
}

From source file:com.android.messaging.datamodel.BugleNotifications.java

private static synchronized void doNotify(final Notification notification,
        final NotificationState notificationState) {
    if (notification == null) {
        return;//from  ww w.  j  a  v a  2  s .c  om
    }
    final int type = notificationState.mType;
    final ConversationIdSet conversationIds = notificationState.mConversationIds;
    final boolean isBundledNotification = (notificationState instanceof BundledMessageNotificationState);

    // Mark the notification as finished
    notificationState.mCanceled = true;

    final NotificationManagerCompat notificationManager = NotificationManagerCompat
            .from(Factory.get().getApplicationContext());
    // Only need conversationId for tags with a single conversation.
    String conversationId = null;
    if (conversationIds != null && conversationIds.size() == 1) {
        conversationId = conversationIds.first();
    }
    final String notificationTag = buildNotificationTag(type, conversationId, isBundledNotification);

    notification.flags |= Notification.FLAG_AUTO_CANCEL;
    notification.defaults |= Notification.DEFAULT_LIGHTS;

    notificationManager.notify(notificationTag, type, notification);

    LogUtil.i(TAG, "Notifying for conversation " + conversationId + "; " + "tag = " + notificationTag
            + ", type = " + type);
}

From source file:es.javocsoft.android.lib.toolbox.ToolBox.java

/**
 * Creates a system notification.//  ww  w  .j  a  va2  s .c om
 *    
 * @param context            Context.
 * @param notSound            Enable or disable the sound
 * @param notSoundRawId         Custom raw sound id. If enabled and not set 
 *                         default notification sound will be used. Set to -1 to 
 *                         default system notification.
 * @param multipleNot         Setting to True allows showing multiple notifications.
 * @param groupMultipleNotKey   If is set, multiple notifications can be grupped by this key.
 * @param notAction            Action for this notification
 * @param notTitle            Title
 * @param notMessage         Message
 * @param notClazz            Class to be executed
 * @param extras            Extra information
 * 
 */
public static void notification_generate(Context context, boolean notSound, int notSoundRawId,
        boolean multipleNot, String groupMultipleNotKey, String notAction, String notTitle, String notMessage,
        Class<?> notClazz, Bundle extras, boolean wakeUp) {

    try {
        int iconResId = notification_getApplicationIcon(context);
        long when = System.currentTimeMillis();

        Notification notification = new Notification(iconResId, notMessage, when);

        // Hide the notification after its selected
        notification.flags |= Notification.FLAG_AUTO_CANCEL;

        if (notSound) {
            if (notSoundRawId > 0) {
                try {
                    notification.sound = Uri.parse("android.resource://"
                            + context.getApplicationContext().getPackageName() + "/" + notSoundRawId);
                } catch (Exception e) {
                    if (LOG_ENABLE) {
                        Log.w(TAG, "Custom sound " + notSoundRawId + "could not be found. Using default.");
                    }
                    notification.defaults |= Notification.DEFAULT_SOUND;
                    notification.sound = RingtoneManager.getDefaultUri(RingtoneManager.TYPE_NOTIFICATION);
                }
            } else {
                notification.defaults |= Notification.DEFAULT_SOUND;
                notification.sound = RingtoneManager.getDefaultUri(RingtoneManager.TYPE_NOTIFICATION);
            }
        }

        Intent notificationIntent = new Intent(context, notClazz);
        notificationIntent.setAction(notClazz.getName() + "." + notAction);
        if (extras != null) {
            notificationIntent.putExtras(extras);
        }

        //Set intent so it does not start a new activity
        //
        //Notes:
        //   - The flag FLAG_ACTIVITY_SINGLE_TOP makes that only one instance of the activity exists(each time the
        //      activity is summoned no onCreate() method is called instead, onNewIntent() is called.
        //  - If we use FLAG_ACTIVITY_CLEAR_TOP it will make that the last "snapshot"/TOP of the activity it will 
        //     be this called this intent. We do not want this because the HOME button will call this "snapshot". 
        //     To avoid this behaviour we use FLAG_ACTIVITY_BROUGHT_TO_FRONT that simply takes to foreground the 
        //     activity.
        //
        //See http://developer.android.com/reference/android/content/Intent.html           
        notificationIntent.setFlags(Intent.FLAG_ACTIVITY_BROUGHT_TO_FRONT | Intent.FLAG_ACTIVITY_SINGLE_TOP);

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

        int REQUEST_UNIQUE_ID = 0;
        if (multipleNot) {
            if (groupMultipleNotKey != null && groupMultipleNotKey.length() > 0) {
                REQUEST_UNIQUE_ID = groupMultipleNotKey.hashCode();
            } else {
                if (random == null) {
                    random = new Random();
                }
                REQUEST_UNIQUE_ID = random.nextInt();
            }
            PendingIntent.getActivity(context, REQUEST_UNIQUE_ID, notificationIntent,
                    PendingIntent.FLAG_ONE_SHOT);
        }

        notification.setLatestEventInfo(context, notTitle, notMessage, intent);

        //This makes the device to wake-up is is idle with the screen off.
        if (wakeUp) {
            powersaving_wakeUp(context);
        }

        NotificationManager notificationManager = (NotificationManager) context
                .getSystemService(Context.NOTIFICATION_SERVICE);

        //We check if the sound is disabled to enable just for a moment
        AudioManager amanager = (AudioManager) context.getSystemService(Context.AUDIO_SERVICE);
        int previousAudioMode = amanager.getRingerMode();
        ;
        if (notSound && previousAudioMode != AudioManager.RINGER_MODE_NORMAL) {
            amanager.setRingerMode(AudioManager.RINGER_MODE_NORMAL);
        }

        notificationManager.notify(REQUEST_UNIQUE_ID, notification);

        //We restore the sound setting
        if (previousAudioMode != AudioManager.RINGER_MODE_NORMAL) {
            //We wait a little so sound is played
            try {
                Thread.sleep(3000);
            } catch (Exception e) {
            }
        }
        amanager.setRingerMode(previousAudioMode);

        Log.d(TAG, "Android Notification created.");

    } catch (Exception e) {
        if (LOG_ENABLE)
            Log.e(TAG, "The notification could not be created (" + e.getMessage() + ")", e);
    }
}

From source file:com.shinymayhem.radiopresets.ServiceRadioPlayer.java

protected void getErrorNotification(String title, String text) {
    NotificationCompat.Builder builder = new NotificationCompat.Builder(this).setContentTitle(title)
            .setContentText(text)//from www .jav  a2  s  .  c  om
            .setLargeIcon(((BitmapDrawable) getResources().getDrawable(R.drawable.app_icon)).getBitmap())
            .setSmallIcon(R.drawable.app_notification);
    TaskStackBuilder stackBuilder = TaskStackBuilder.create(this);
    stackBuilder.addParentStack(ActivityMain.class);
    Intent resultIntent = new Intent(this, ActivityMain.class);
    stackBuilder.addNextIntent(resultIntent);
    PendingIntent intent = stackBuilder.getPendingIntent(0, PendingIntent.FLAG_CANCEL_CURRENT);
    builder.setContentIntent(intent);
    builder.setTicker(title);
    Notification notification = builder.build();
    notification.flags = Notification.FLAG_AUTO_CANCEL; //set notification to be cleared when tapped
    //startForeground(ONGOING_NOTIFICATION, builder.build());
    mNotificationManager.notify(ONGOING_NOTIFICATION, notification);
}

From source file:com.paywith.ibeacon.service.IBeaconService.java

protected void generateNotification(String title, String merchanttext, String murl, String location_id) {

    String ns = Context.NOTIFICATION_SERVICE;
    NotificationManager mNotificationManager = (NotificationManager) getSystemService(ns);

    Builder mNotifyBuilder = new NotificationCompat.Builder(this);

    //int icon = R.drawable.ic_launcher;
    //CharSequence tickerText = "PayWith";
    //long when = System.currentTimeMillis();

    //@SuppressWarnings("deprecation")
    //Notification notification = new Notification(icon,
    //        tickerText, when);

    mNotifyBuilder.setContentText(merchanttext).setContentTitle(title).setSmallIcon(R.drawable.ic_launcher);//logo

    //notification.flags |= Notification.FLAG_AUTO_CANCEL;
    Context context = getApplicationContext();
    Intent notificationIntent = new Intent("android.intent.category.LAUNCHER");
    //CharSequence contentTitle = title;
    //CharSequence contentText = merchanttext;

    notificationIntent.putExtra("OpenUrl", murl);
    notificationIntent.putExtra("MerchantName", merchanttext);
    notificationIntent.setClassName("com.paywith.paywith", "com.paywith.paywith.MainActivity");

    //PendingIntent contentIntent = PendingIntent
    //         .getActivity(context, 0, notificationIntent, PendingIntent.FLAG_UPDATE_CURRENT | PendingIntent.FLAG_ONE_SHOT);

    //notification.setLatestEventInfo(context, contentTitle,
    //        contentText, contentIntent);

    //mNotificationManager.notify(ongoing_notification_id, notification);

    PendingIntent contentIntent = PendingIntent.getActivity(context, 0, notificationIntent,
            PendingIntent.FLAG_UPDATE_CURRENT | PendingIntent.FLAG_ONE_SHOT);
    // PendingIntent.FLAG_UPDATE_CURRENT | PendingIntent.FLAG_ONE_SHOT

    // this gives us flexibility to add vibration and sound etc:
    Notification note = mNotifyBuilder.build();

    // THIS line is what makes the notification tappable to launch app and generate mCard payment:
    note.setLatestEventInfo(context, title, merchanttext, contentIntent);

    // make phone vibrate and make sound on notification:
    note.defaults |= Notification.DEFAULT_VIBRATE;
    note.defaults |= Notification.DEFAULT_SOUND;

    notificationIntent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_SINGLE_TOP);
    //Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_SINGLE_TOP

    note.flags |= Notification.FLAG_AUTO_CANCEL;
    // Because the ID remains unchanged, the existing notification is updated.
    mNotificationManager.notify(ongoing_notification_id, note);
    //Log.e("notification","sent");
}

From source file:com.zuzhili.bussiness.helper.CCPHelper.java

/**
 * ???// w  ww. j a v a  2s .  com
 * content  ?
 */
private void showMsgNotification(Context context, String content, String ticker, String listId) {
    // NotificationManager
    NotificationManager notificationManager = (NotificationManager) context
            .getSystemService(android.content.Context.NOTIFICATION_SERVICE);

    // ?
    Intent notificationIntent = new Intent(context, HomeTabActivity.class); // ??Activity
    notificationIntent.putExtra(Constants.TO_GROUPSLISTFRG, "ok");
    notificationIntent.putExtra(Constants.CHANGE_SOCIAL, listId);
    notificationIntent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);//Intent.FLAG_ACTIVITY_SINGLE_TOP|
    notificationIntent.addCategory(Intent.CATEGORY_LAUNCHER);
    notificationIntent.setData(Uri.parse("custom://" + System.currentTimeMillis()));
    PendingIntent contentItent = PendingIntent.getActivity(context, 0, notificationIntent,
            PendingIntent.FLAG_UPDATE_CURRENT);

    // Notification??
    Notification notification = new NotificationCompat.Builder(context)
            .setContentTitle(context.getString(R.string.new_msg_notification_title)).setContentText(content)
            .setSmallIcon(R.drawable.notify).setTicker(ticker).setContentIntent(contentItent)
            .setWhen(System.currentTimeMillis()).build();

    //FLAG_AUTO_CANCEL   ??
    notification.flags |= Notification.FLAG_AUTO_CANCEL;
    notification.flags |= Notification.FLAG_SHOW_LIGHTS;
    //DEFAULT_VIBRATE <uses-permission android:name="android.permission.VIBRATE" />??
    notification.defaults = Notification.DEFAULT_VIBRATE;
    notification.defaults |= Notification.DEFAULT_SOUND;
    notification.ledARGB = Color.BLUE;
    notification.ledOnMS = 5000; //

    // ? NotificationNotificationManager
    notificationManager.cancel(0);
    notificationManager.notify(0, notification);
}

From source file:org.restcomm.app.qoslib.Services.Intents.IntentHandler.java

private void postSurvey(int surveyid) {
    int icon = 0;
    int customIcon = (owner.getResources().getInteger(R.integer.CUSTOM_NOTIFIER));
    if (customIcon == 0)
        icon = R.drawable.ic_stat_mmcactive;
    else/*from   w  w w .j a  va 2s  .co  m*/
        icon = R.drawable.ic_stat_notification_icon;

    if (surveyid > 0) {

        int curr_id = PreferenceManager.getDefaultSharedPreferences(owner).getInt("surveyid", 0);

        if (curr_id == surveyid)
            return;
        //resultIntent.putExtra("id", surveyid);
        requestQuestions(surveyid);
    } else { //default survey id = 1
        //resultIntent.putExtra("id",1);
        requestQuestions(1);
    }

    String message = owner.getString(R.string.survey_notification);
    NotificationManager notificationManager = (NotificationManager) owner
            .getSystemService(Context.NOTIFICATION_SERVICE);
    Notification notification = new Notification(icon, message, System.currentTimeMillis());
    notification.flags |= Notification.FLAG_AUTO_CANCEL;
    Intent notificationIntent = new Intent();
    notificationIntent.setComponent(
            new ComponentName(owner.getPackageName(), "com.cortxt.app.mmcui.Activities.SatisfactionSurvey"));
    notificationIntent.putExtra("id", surveyid);
    notificationIntent.setData((Uri.parse("foobar://" + SystemClock.elapsedRealtime())));
    notificationIntent.setFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP | Intent.FLAG_ACTIVITY_CLEAR_TOP);
    int MMC_SURVEY_NOTIFICATION = 8011;
    PendingIntent pendingIntent = PendingIntent.getActivity(owner, MMC_SURVEY_NOTIFICATION + surveyid,
            notificationIntent, PendingIntent.FLAG_UPDATE_CURRENT);

    notification.setLatestEventInfo(owner, message, message, pendingIntent);
    notificationManager.notify(MMC_SURVEY_NOTIFICATION, notification);
}

From source file:org.restcomm.app.qoslib.Services.LibPhoneStateListener.java

public void popupDropped(final EventType droptype, final int rating, final int evtId) {
    if (rating == 0)
        return;/*w  w w  .ja  v a  2s.  c o m*/
    owner.handler.post(new Runnable() {
        // @Override
        public void run() {
            String message = "";
            int icon;
            icon = R.drawable.ic_stat_dropped;
            String title = "";
            String msg = "";

            // server can specify whether a confirmation can be invoked on a low rated potentially-dropped call
            int allowConfirm = PreferenceManager.getDefaultSharedPreferences(owner)
                    .getInt(PreferenceKeys.Miscellaneous.ALLOW_CONFIRMATION, 5);
            String noConfirm = (owner.getResources().getString(R.string.NO_CONFIRMATION));
            int allowPopup = PreferenceManager.getDefaultSharedPreferences(owner)
                    .getInt(PreferenceKeys.Miscellaneous.ALLOW_DROP_POPUP, 2);
            if (allowPopup == 1 && !owner.getUseRadioLog())
                allowPopup = 0;
            if (allowPopup == 0)
                return;

            if (noConfirm.equals("1"))
                allowConfirm = 0;
            if (allowConfirm > 0 && rating < allowConfirm && rating < 4) // if confirmation allow, must be above threshold or high rating dropped call
                return;
            else if (allowConfirm == 0 && rating < 4) // drop call silently if marginal with no confirmation
                return;
            // allowConfirm>=5 disables the confirmation because rating always <= 5
            // allowConfirm=1 hits the 'else' and invokes confirmation if rating >= 1 and <5
            // allowConfirm=3 hits the 'else' and invokes confirmation if rating >= 3 and <5
            int expiry = 60000 * 2 * 60;
            int customText = (owner.getResources().getInteger(R.integer.CUSTOM_EVENTNAMES));
            message = owner.getString((customText == 1) ? R.string.sharecustom_speedtest_wifi
                    : R.string.sharemessage_speedtest_wifi);

            if (rating >= 5 || allowConfirm == 0) {
                title = Global.getAppName(owner);
                msg = "mmc detected ";
                if (droptype == EventType.EVT_CALLFAIL)
                    message = owner.getString((customText == 1) ? R.string.Custom_Notification_call_failed
                            : R.string.MMC_Notification_call_failed);
                else
                    message = owner.getString((customText == 1) ? R.string.Custom_Notification_call_dropped
                            : R.string.MMC_Notification_call_dropped);
                message += ": " + owner.getString(R.string.MMC_Notification_view_event);
                msg += message;
            } else if (rating >= allowConfirm && rating > 1) {
                if (droptype == EventType.EVT_CALLFAIL) {
                    title = owner.getString((customText == 1) ? R.string.Custom_Notification_did_you_fail
                            : R.string.MMC_Notification_did_you_fail);
                    message = owner.getString((customText == 1) ? R.string.Custom_Notification_did_failed
                            : R.string.MMC_Notification_did_failed);
                } else if (droptype == EventType.EVT_DROP) {
                    title = owner.getString((customText == 1) ? R.string.Custom_Notification_did_you_drop
                            : R.string.Custom_Notification_did_dropped);
                    message = owner.getString((customText == 1) ? R.string.MMC_Notification_did_dropped
                            : R.string.MMC_Notification_did_dropped);
                } else if (droptype == EventType.EVT_DISCONNECT || droptype == EventType.EVT_UNANSWERED) {
                    expiry = 60000;
                    icon = R.drawable.ic_stat_disconnect;
                    title = owner.getString((customText == 1) ? R.string.Custom_Notification_did_you_disconnect
                            : R.string.MMC_Notification_did_you_disconnect);
                    message = owner.getString((customText == 1) ? R.string.Custom_Notification_did_disconnect
                            : R.string.MMC_Notification_did_disconnect);
                }
                msg = message;
            }

            java.util.Date date = new java.util.Date();
            String time = date.toLocaleString();
            msg += " at " + time;
            //Toast toast = Toast.makeText(MainService.this, msg, Toast.LENGTH_LONG);
            //toast.show();

            NotificationManager notificationManager = (NotificationManager) owner
                    .getSystemService(Service.NOTIFICATION_SERVICE);
            Notification notification = new Notification(icon, message, System.currentTimeMillis());
            notification.flags |= Notification.FLAG_AUTO_CANCEL;
            //Intent notificationIntent = new Intent(MainService.this, Dashboard.class);
            Intent notificationIntent = new Intent();//, "com.cortxt.app.mmcui.Activities.Dashboard");
            notificationIntent.setClassName(owner, "com.cortxt.app.uilib.Activities.Dashboard");
            notificationIntent.putExtra("eventId", evtId);

            notificationIntent.setData((Uri.parse("foobar://" + SystemClock.elapsedRealtime())));
            notificationIntent.setFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP | Intent.FLAG_ACTIVITY_CLEAR_TOP);
            PendingIntent pendingIntent = PendingIntent.getActivity(owner, MMC_DROPPED_NOTIFICATION + evtId,
                    notificationIntent, PendingIntent.FLAG_UPDATE_CURRENT);

            notification.setLatestEventInfo(owner, title, message, pendingIntent);
            notificationManager.notify(MMC_DROPPED_NOTIFICATION, notification);
            long expirytime = System.currentTimeMillis() + expiry;
            PreferenceManager.getDefaultSharedPreferences(owner).edit()
                    .putLong(PreferenceKeys.Monitoring.NOTIFICATION_EXPIRY, expirytime).commit();

        }
    });

}

From source file:com.mobicage.rogerthat.plugins.messaging.MessagingPlugin.java

private void showTransferPendingNotification(String notificationMessage) {
    T.dontCare();//from  w ww.j a v a  2  s .c o m
    NotificationCompat.Builder mBuilder = new NotificationCompat.Builder(mMainService)
            .setContentTitle(mMainService.getString(R.string.app_name)).setContentText(notificationMessage)
            .setSmallIcon(R.drawable.ic_menu_upload)
            .setStyle(new NotificationCompat.BigTextStyle().bigText(notificationMessage)).setAutoCancel(false);

    final NotificationManager nm = (NotificationManager) mMainService
            .getSystemService(Context.NOTIFICATION_SERVICE);
    Notification notification = mBuilder.build();
    notification.flags |= Notification.FLAG_ONGOING_EVENT;
    notification.flags &= ~Notification.FLAG_AUTO_CANCEL;

    Intent i = new Intent(MainActivity.ACTION_NOTIFICATION_OPEN_APP, null, mMainService, MainActivity.class);
    i.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
    PendingIntent pi = PendingIntent.getActivity(mMainService, 1000, i, PendingIntent.FLAG_UPDATE_CURRENT);

    notification.contentIntent = pi;

    nm.notify(R.integer.photo_upload_pending, notification);
}