Prevent notification PendingIntent starts Activity already started?
<p>The service creates a persistent <code>Notification</code> and starts the main activity on click via <code>PendingIntent</code>. Here is the code.</p>

<pre><code>Intent notificationIntent = new Intent(getApplicationContext(), ViewPagerActivity.class);
PendingIntent pendingIntent = PendingIntent.getActivity(StreamingService.this, 0, notificationIntent, 0);
</code></pre>

<p>However, if <strong>the main activity is started</strong> when I press notification, it will be started <strong>again</strong>, and again and... </p>

<p>In the end, I have the same activity pilled up, one on the top of another. I can see this by pressing the back button, which will kill the Main activity once and then get me back to the same activity until I close the last one. </p>

<p>How can I prevent this to happen? Can <code>PendingIntent</code> detect that aiming activity is running so it does not create the same activity again, but rather start the running one?</p>

<p>PS. I apologize if not being able to explain this well. If this is the case, let me know and I will rephrase the problem. </p>
