Q:

Close all Activities when the app returns from being in the background

It is important in my app that when a user presses the home button and the app enters the "Background" the app reverts to the login screen next time it is opened.
I have tried using the
 android:noHistory 

in the manifest but this means when pressing back on activities it reverts also to the login screen so is no good. I have also tried using 
android:clearTaskOnLaunch="true"

in my initial activity but this doesn't seem to have any effect. I don't finish() the first activity so i am not sure why this doesn't work.
Can anyone help with a way of doing this.

A:

I got this working by using
 android:clearTaskOnLaunch="true"

Turns out that I didn't have it in my root activity, this was because I have a second login screen which asks for less details depending on if you have logged in before.
Although it works exactly as i want it to, apparently using this "Android" feature is incorrect because i am going "against" android by clearing the tasks (activities) when the home button is pressed and my app should follow someone else opinion of what an "app" should do. Who Knew!

