My goal is to return back to last activity if user click in notification. I create the notification from in the service onCreate() in this way:
Intent notificationIntent = new Intent(this, MainActivity.class);
notificationIntent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_SINGLE_TOP);
PendingIntent contentIntent = PendingIntent.getActivity(this, 0, notificationIntent, 0);
but when I click on the notification this go to the MainActivity and not to the last one opened before to click home button.
In manifest I have tried with the MainActivity with launchMode="singleTop", "standard" and "singletask" but without success.
Thank's.