title: android-avoiding activity recreation when clicking notification not working
body: <p>I have a single <code>Activity</code> in my app (called MainActivity) and when I send notification to user, I want it to get opened if the notification is clicked. <strong>the important point is to avoid activity recreation and if there is already an instance of it alive, bring it to front and deliver the data to it</strong>. to get this behavior I have tried:</p>
  <pre><code>Intent intent = new Intent(getApplicationContext(), MainActivity.class)
  .setFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP)
  .putExtra(&quot;data&quot;, ...);
  PendingIntent pendingIntent = PendingIntent.getActivity(getApplicationContext(), 0, intent, PendingIntent.FLAG_UPDATE_CURRENT);
  </code></pre>
  <p>and in manifest:</p>
  <pre><code>&lt;activity
   android:name=&quot;...activities.MainActivity&quot;
   android:launchMode=&quot;singleTop&quot;
   android:screenOrientation=&quot;portrait&quot;
   android:theme=&quot;@style/Theme.AppCompat.Light.NoActionBar.FullScreen.Light&quot;&gt;
      &lt;intent-filter&gt;
      &lt;action android:name=&quot;android.intent.action.MAIN&quot; /&gt;
      &lt;category android:name=&quot;android.intent.category.LAUNCHER&quot; /&gt;
      &lt;/intent-filter&gt;
   activity&gt;
  </code></pre>
  <p>but the <code>onNewIntent(Intent intent)</code> method never gets called when I touch the notification, instead <code>onCreate</code> is called and the activity is recreated. please note that since I'm testing, I send the notification from the MainActivity itself and while it is open, I drag status bar and click on my notification (which then recreates the MainActivity). what is the problem?</p>