Android clear activity list on home button press

Issue

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, aave a look at the link below, this will help you doing what you want.

Kill all activities when HOME key is pressed android

Answered By – Usama Sarwar

This Answer collected from stackoverflow, is licensed under cc by-sa 2.5 , cc by-sa 3.0 and cc by-sa 4.0

Leave a Reply

(*) Required, Your email will not be published