title: Click on notification starts activity twice
body: <p>I'm creating a notification from a service with the following code:</p>
  
  <pre><code>NotificationManager notificationManager = (NotificationManager) ctx
  .getSystemService(Context.NOTIFICATION_SERVICE);
  
  CharSequence tickerText = "bla ...";
  long when = System.currentTimeMillis();
  Notification notification = new Notification(R.drawable.icon,
  tickerText, when);
  
  Intent notificationIntent = new Intent(ctx, SearchActivity.class).
  putExtra(SearchActivity.INTENT_SOURCE,
  MyNotificationService.class.getSimpleName());
  
  PendingIntent contentIntent = PendingIntent.getActivity(ctx, 0,
  notificationIntent, 0);
  notification.setLatestEventInfo(ctx, ctx.getString(R.string.app_name),
  tickerText, contentIntent);
  notification.flags |= Notification.FLAG_AUTO_CANCEL;
  notificationManager.notify(1, notification);
  </code></pre>
  
  <p>The logs clearly says that the the method startActivity is called twice times:</p>
  
  <pre><code>04-02 23:48:06.923: INFO/ActivityManager(2466): Starting activity: Intent { act=android.intent.action.SEARCH cmp=com.xy/.SearchActivity bnds=[0,520][480,616] (has extras) }
  04-02 23:48:06.923: WARN/ActivityManager(2466): startActivity called from non-Activity context; forcing Intent.FLAG_ACTIVITY_NEW_TASK for: Intent { act=android.intent.action.SEARCH cmp=com.xy/.SearchActivity bnds=[0,520][480,616] (has extras) }
  04-02 23:48:06.958: INFO/ActivityManager(2466): Starting activity: Intent { act=android.intent.action.SEARCH cmp=com.xy/.SearchActivity bnds=[0,0][480,96] (has extras) }
  04-02 23:48:06.958: WARN/ActivityManager(2466): startActivity called from non-Activity context; forcing Intent.FLAG_ACTIVITY_NEW_TASK for: Intent { act=android.intent.action.SEARCH cmp=com.xy/.SearchActivity bnds=[0,0][480,96] (has extras) }
  04-02 23:48:07.087: INFO/notification(5028): onStartCmd: received start id 2: Intent { cmp=com.xy/.NotificationService }
  04-02 23:48:07.310: INFO/notification(5028): onStartCmd: received start id 3: Intent { cmp=com.xy/.NotificationService }
  04-02 23:48:07.392: INFO/ActivityManager(2466): Displayed activity com.xy/.SearchActivity: 462 ms (total 462 ms)
  04-02 23:48:07.392: INFO/ActivityManager(2466): Displayed activity com.xy/.SearchActivity: 318 ms (total 318 ms)
  </code></pre>
  
  <p><strong>Why are they started twice?</strong></p>
  
  <p>There are two identical questions on stackoverflow: <a href="https://stackoverflow.com/questions/2326622/starting-activity-through-notification-avoiding-duplicate-activities">here</a> and <a href="https://stackoverflow.com/questions/4333946/android-notification-launches-same-activity-twice">here</a>.
  But they do not explain what the initial issue could be and they do not work for me. E.g. changing to launchMode singleTop is not appropriated for me and it should work without changing launchMode according to the <a href="http://developer.android.com/guide/topics/search/search-dialog.html" rel="nofollow noreferrer">official docs</a> (see Invoking the search dialog).</p>
  
  <p>Nevertheless I also tried to add the following flags to notificationIntent</p>
  
  <p>Intent.FLAG_ACTIVITY_CLEAR_TOP | PendingIntent.FLAG_UPDATE_CURRENT</p>
  
  <p>but the problem remains the same.</p>