1

I want to remove my app from recent apps when I pressed back key but it remains in recent apps if I press Home key. I have tried setting

<activity
       android:name=".MyActivity"
       android:launchMode="singleInstance"
       android:excludeFromRecents="true" >
</activity>

But it also remove when I press HOME key. Kindly help me. Thanks in advance.

Nuraiz
  • 1,060
  • 6
  • 17
  • 35
  • does it remove or not? – Rahul Feb 20 '13 at 12:11
  • What is the difference between using the home or back key (in your opinion) when leaving the application? Both return to the home screen. So I guess you will only confuse the user with this behavior. Unless you *do have* a good reasons for it, hence my question. – Veger Feb 20 '13 at 12:12
  • App removes from recent but I want my app only from recent when I press BACK key – Nuraiz Feb 20 '13 at 12:13
  • Pressing HOME means app still running in background and BACK means user quits and not running in background. – Nuraiz Feb 20 '13 at 12:14
  • Do you users also know this? As it is not default Android behavior – Veger Feb 20 '13 at 12:18
  • Yes, they know about this. – Nuraiz Feb 20 '13 at 12:19
  • Try Override backbutton in the activity it self and set the singleInstance and excludefromRecents flags and then finish() the activity – Pragnani Feb 20 '13 at 12:24
  • @Pragnani: can you tell how I can add flags to current activity? – Nuraiz Feb 20 '13 at 18:19

1 Answers1

1

add android:excludeFromRecents="true" in activity definition manifest file

same Q: How to remove application from recent application list?

or

protected void onPause() {
  finish();
}

or

android:noHistory= "true";
Community
  • 1
  • 1
mahesh
  • 909
  • 2
  • 18
  • 37