Search code examples
androidandroid-activity

Android clear activity list on home button press


My application has several activities the first being a logon screen, I want to always force the user to logon even if they have stopped the application using the home button and the restored it. Is there a way to achieve this in android?


Solution

  • Use android:clearTaskOnLaunch="true" in your Launcher Activity in the manifest and for all other activities use android:finishOnTaskLaunch="true" in the manifest.

    For a reference, have a look at the link below, this will help you doing what you want.

    Kill all activities when HOME key is pressed android