8

I need to delete app from recently used apps list. There is no problem on API level 21 and above. I use finishAndRemoveTask() method. But that method cannot be used on API levels lover than 21. How can I call that method on API levels lover than 21?

I tried that solutions but they does not work :

Close application and remove from recent apps/

Kartik Agarwal
  • 1,129
  • 1
  • 8
  • 27
cimenmus
  • 1,386
  • 4
  • 18
  • 31

2 Answers2

3

Prease, check code below

    if (Build.VERSION.SDK_INT >= 21)
        finishAndRemoveTask();
    else
        finish();
    System.exit(0);
Igor Silva
  • 39
  • 4
1

I solved the problem with that library :

https://github.com/Ereza/CustomActivityOnCrash

cimenmus
  • 1,386
  • 4
  • 18
  • 31