Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Using finishAndRemoveTask() method of Activity class on API levels lower than 21

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/

like image 210
cimenmus Avatar asked Nov 25 '16 09:11

cimenmus


1 Answers

Prease, check code below

    if (Build.VERSION.SDK_INT >= 21)
        finishAndRemoveTask();
    else
        finish();
    System.exit(0);
like image 83
Igor Silva Avatar answered Nov 06 '22 08:11

Igor Silva