title: Start new activity from notification in existing task
body: <p>My app receives pushes and opens different activities according to the push type.</p>
  
  <p>I use <code>TaskStackBuilder</code> for a pending Intent to create a synthetic backstack in conjunction with <code>android:parentActivityName</code>in my manifest. </p>
  
  <p>So far, so easy. When the App is not started, all works as expected. <strong>But if the app is in background</strong> (task is running), the pending Intent also starts my desired activity with the defined parent from the manifest, <strong>but resets</strong> the existing task. The problem is that other activities that were started by the user in the meantime are also cleared.   <a href="https://i.stack.imgur.com/9nwK9.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/9nwK9.png" alt="enter image description here"></a></p>
  
  <p>So what a want to achieve is:</p>
  
  <ol>
  <li>if the app is not started, open the desired activity with the synthetic backstack (MainActivity)</li>
  <li>if the app is running, respect the current task order and just push the desired activity on top of it.</li>
  </ol>
  
  <p>I can't seem to make it work with the <code>TaskStackBuilder</code>.</p>
  
  <p>I'd be happy for some insights. </p>