How to use Tasker to close app on exit I use my phone for private things such as social media and telephone banking. These apps that I won't want others to access if they had my phone and it was unlocked I have them blocked through App Lock. 

However pressing the recent apps list (left touch button on Samsung s7) displays the list of apps and also gives a still image of what was happening in that app. I was advised Tasker can be used to resolve this by completely closing an app upon exit whether by pressing that event apps button or the back button or home button, so it no longer appears on recent apps list. 

However Tasker is very complicated and I was hoping someone could share the wisdom of how this can be done.
After hours of researching I am pleased to inform you that I have found a way to clear the recent apps lists in Tasker

Prerequisites:


Autoinput plugin
Root


Open tasker and head to Task tab: You can name it Clear recent apps


A1: AutoInput Global Action [ Configuration:Action: Recent Apps Timeout (Seconds):20 ]
A2: Task Wait Value: 250 MS
A3: Code → Run shell → Command input tap 405.3 1198.5 and use root ( this is the x,y co-oordinates of the point on screen which will be simulated by a tap event - my device is 720x1280.
You can obtain  your x,y coordinates by enabling show pointer location/cursor position in developer options )
A4: AutoInput Global Action [ Configuration:Action: Home Timeout (Seconds):20 ]
A5: Flash [ Text:Apps cleared Long:Off ] (You may need this flash notification to know what took place)


Now for the profile;


Go to Profiles tab and choose Application (The list of "secure apps" )
Now for entry task just create Task Wait action and choose any waiting period e.g. 2 seconds
For the exit task choose the previously created task ( Clear recent apps)


Note: Try not to test this profile when Tasker is running in foreground/included in recent apps because it may crash or go into a loop. But once the profile is set it runs smoothly as required. 

Credits:


how to create close recent app list
Tasker: clear recent apps command