Search code examples
androidandroid-activitynotificationsactivity-manager

After notification button return to original activity


I wrote an app, that brings up a notification every certain time via an alarmIntent. The user clicks on the notification and gets into an activity. After doing something in this activity he should press a button to return to the original app he was in (like a browser, or the homescreen, etc.), before clicking on the notification. My problem is, that the user always returns to the main activity of my application. How can I change that?

Thank you!


Solution

  • So I found the solution finaly: you need to add the Intent.FLAG_ACTIVITY_MULTIPLE_TASKS flag to the intent as explained in that question: Go back to previous screen on backbutton pressed after responding to notification