title: How to correctly open file on notification click
body: <p>I'm donloading files from the Internet using <code>IntentService</code> and displaying a <code>Notification</code> while download is in progress. After download complete I need to be able to click on the notification to open downloaded file in appropriate application. Here's a code I'm using for this:</p>
  
  <pre><code>Intent intent = IntentUtils.getOpenFileIntent(task.getTargetFolder()
      + File.separator + task.getFileNode().getName());
  TaskStackBuilder taskStackBuilder = TaskStackBuilder.create(this);
  taskStackBuilder.addParentStack(MainActivity.class);
  taskStackBuilder.addNextIntent(intent);
  PendingIntent pi = taskStackBuilder.getPendingIntent(0,
      PendingIntent.FLAG_UPDATE_CURRENT);
  builder.setContentIntent(pi);
  </code></pre>
  
  <p>And here's how I create the <code>Intent</code>:</p>
  
  <pre><code>public static Intent getOpenFileIntent(String path) {
      File file = new File(path);
      Uri uri = Uri.fromFile(file);
      MimeTypeMap mime = MimeTypeMap.getSingleton();
      String extension = fileExt(path);
      String type = mime.getMimeTypeFromExtension(extension);
      Intent intent = new Intent(Intent.ACTION_VIEW);
      intent.setDataAndType(uri, type);
      return intent;
  }
  </code></pre>
  
  <p>The issue is that tapping on the notification closes any of the currently opened app. I just need to display application chooser over the currently opened app. I think that the issue is in <code>TaskStackBuilder</code> usage but there's no other way to create <code>PendingIntent</code> instance for <code>ACTION_VIEW</code> <code>Intent</code>.</p>