title: Android Notification: Intent.FLAG_ACTIVITY_NEW_TASK required?
body: <p>In the document of the <code>Notification</code> class I see this:</p>
  
  <blockquote>
    <p><strong>public PendingIntent contentIntent</strong></p>
    
    <p>The intent to execute when the expanded status entry is clicked. If this is an activity, it must include the <code>FLAG_ACTIVITY_NEW_TASK</code> flag, which requires that you take care of task management as described in the <a href="http://developer.android.com/guide/topics/fundamentals/tasks-and-back-stack.html" rel="noreferrer">Tasks and Back Stack</a> document. In particular, make sure to read the notification section <a href="http://developer.android.com/guide/topics/ui/notifiers/notifications.html#HandlingNotifications" rel="noreferrer">Handling Notifications</a> for the correct ways to launch an application from a notification.</p>
  </blockquote>
  
  <p>I've read the materials linked from the above, but I still don't get it. Why is the <code>FLAG_ACTIVITY_NEW_TASK</code> flag required when an activity is to be started from clicking a notification? I tried the following code:</p>
  
  <pre><code>NotificationManager manager = (NotificationManager)context.
      getSystemService(Context.NOTIFICATION_SERVICE);
  Notification notification = new Notification(
      android.R.drawable.stat_notify_sync, title,
      System.currentTimeMillis());
  notification.flags |= Notification.FLAG_AUTO_CANCEL;
  Intent intent = new Intent(context, NotifiedActivity.class);
  intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);  // IS THIS REALLY REQUIRED??
  PendingIntent pt = PendingIntent.getActivity(context, 0, intent, 0);
  notification.setLatestEventInfo(context, title, text, pt);
  manager.notify(0, notification);
  </code></pre>
  
  <p>I ran the above code, both with and without the <code>intent.setFlags</code> line, and there seems to be no difference. In fact, many code samples I found simply don't have that line. So why does the document says that the <code>FLAG_ACTIVITY_NEW_TASK</code> flag is a must, and exactly what difference does it make in notification handling?</p>