just_user
just_user

Reputation: 12067

How to not open an activity which has been finished through recent apps

From Activity A, I open Activity B which starts a sticky Service. Then I press the home button which puts the app in background. I open recent apps and close my app, Sticky Service keeps running.

Clicking the app icon brings me back to the Launcher Activity A. But if I instead click the sticky Service Notification I'm brought back to Activity B which is correct. If I at this moment stop Activity B and the Sticky Service which also finishes the app, then if I go to recent apps and open my app I'm brought back to Activity B which is wrong, it should take me back to Activity A. But only if I have killed the Sticky Service.

How can this be achieved?

Is there an intent flag for this? Or do I have to use some extras with the intent to tell the app where it's started from?

Upvotes: 1

Views: 81

Answers (1)

Pararth
Pararth

Reputation: 8134

using excludeFromRecents for Activity B could serve your purpose, without changing anything else

Upvotes: 1

Related Questions