Android: launch new activity when it not exist
<p>I have a service that work in foreground, and when the Main activity launch it the notification is launched with the following code:</p>

<pre><code>private void showNotification() {
    Log.i(TAG, LocalService.class.getName() + "showNotification()");
    Intent notificationIntent = new Intent(getApplicationContext(), NotificationActivity.class);
    //notificationIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); 
    notificationIntent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_SINGLE_TOP);
    PendingIntent contentIntent = PendingIntent.getActivity(getApplicationContext(), 0, notificationIntent, 0);

    nm = (NotificationManager) getApplicationContext().getSystemService(Context.NOTIFICATION_SERVICE);
    // Set the icon, scrolling text and timestamp

    int icontouse = R.drawable.icon;
    if (app.prefs.getBoolean("prefs_useprivacyicon", false)) {
        icontouse = R.drawable.icon_privacy;
    }

    n = new Notification(icontouse, getString(R.string.voice_pro_ready), System.currentTimeMillis());

    n.contentView = getRemoteView();
    n.contentIntent = contentIntent;

    startForeground(myID, n);
    nm.notify(myID, n);
}
</code></pre>

<p>my problem is the PendingIntent, if the Main activity was in pause status, then this become in front when click on notify in statusbar, but if the Main activity was closed by finish() this don't become visible.</p>

<p>I need to make possible that if the Activity is in memory than become visible, if not available in memory, then launch a new instance.</p>
