title: Launching an Activity from an ongoing Notification crashes the second time around
body: <p>I have an app that uses an ongoing Notification to let the user know its running. This comes in handy since it needs to be running all the time in the background in order to receive messages. The app mainly consists of one Activity with many fragments and a couple of services.</p>
  
  <p>This is the method I use to show and update the notification. Its implemented in a class called Notifications.java
  Its method is called in onResume of the MainActivity as well as by the service that receives messages.</p>
  
  <pre><code>public static void updateOngoingNotification(Context c, String text) {
      Intent intent = new Intent(c, MainActivity.class);
      intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
      PendingIntent pIntent = PendingIntent.getActivity(c, 0, intent, PendingIntent.FLAG_UPDATE_CURRENT);
  
      NotificationCompat.Builder mBuilder = new NotificationCompat.Builder(c)
              .setSmallIcon(R.drawable.ic_launcher)
              .setOngoing(true)
              .setContentText(text)
              .setContentTitle(c.getString(R.string.app_name))
              .setContentIntent(pIntent);
  
      NotificationManager notificationManager = (NotificationManager) c
              .getSystemService(c.NOTIFICATION_SERVICE);
      notificationManager.notify(0, mBuilder.build());
  }
  </code></pre>
  
  <p>The problem is, that everything seems to works as it should, but when I try to launch the Activity a second time, the app freezes. I was suspecting the notification IDs or missing flags but had no luck finding a solution so far.</p>