The app has 2 tasks of activities:
Activity A (launcher)Activity BActivity C <---- that's where the stack points at in the example.Now try that:
Application instance is created (Application#onCreate() is called).The funny thing is that if you're here:
Activity A (launcher)Activity B <---- here...and you do repeat the scenario, your application is killed and android goes back to the Home screen as I think it should.
In short, it looks like Android does not clear all the tasks when killing the application. This is only true in that very precise scenario. Go to Settings > Applications > Your App > Force Stop, and you will see that it does clear all the tasks.
Anything we can do to force Android to kill all the tasks when killing the application?
Tasks are meant to be created for independent jobs. That's why it's said that singleInstance and singleTask starts the Activity at the ROOT of new task (as the root activity for that particular task). Because when you click one of the tasks from Overview Screen, the Android system needs a way of launching the task (in that case, it needs a launcher/root activity).
So, one you kill one task, it shouldn't kill the other one since user might want to switch that INDEPENDENT app task later right?
But it's hard to manage that behaviour since you need to properly handle (mostly navigation and user experience) saperate tasks. So think before you act that way. Android document itself says so;
"The other modes — singleTask and singleInstance — are not appropriate for most applications, "
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With