I have an activity which is called if the app receives a push notification. The activity is started with FLAG_ACTIVITY_NEW_TASK
and FLAG_ACTIVITY_CLEAR_TOP
. The activity, let's call it 'A' shows UI and finishes after a while. In this point have a problem with activity stack.
Scenario:
- The app is in the background with another activity 'B'
- Then the app receives a push notification and starts Activity A.
- After related things done, the app finishes Activity A
- Then returns to Activity B and stays in the foreground even the app was in the background before the push notification is received.
After debugging, I figured out that the system calls onResume
method of Activity B after finishing Activity A.
How can I do the app keep staying in background if the app started from background? Should I change intent flags of the activity A?