After receiving a notification in my app, clicking on it opens activity B. Activity B has a parent activity A. Here is the manifest:
I use the following code and it works like a charm. Have a go!
Intent upIntent = new Intent(getApplicationContext(), Home.class);
if (NavUtils.shouldUpRecreateTask(this, upIntent)) {
Log.d("ShowNotifications", "New Home");
TaskStackBuilder.create(this).addNextIntentWithParentStack(upIntent).startActivities();
} else {
Log.d("ShowNotifications", "Old Home");
upIntent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP|Intent.FLAG_ACTIVITY_SINGLE_TOP);
//upIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TASK );
startActivity(upIntent);
finish();
}