My goal is to return to the last action if the user clicks on the notification. I am creating a notification from the onCreate () service as follows:
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, go to MainActivity, and not to the last one opened before clicking the home button.
In the manifest, I tried with MainActivity with launchMode = "singleTop", "standard" and "singletask", but without success.
Thank x.
source share