I currently close Apps with Tasker/AutoInput. Either by using the Back button as needed, or if the App has a close or exit menu button, I use that one.
The issue I have is that I have to bring the App into foreground.
Alternatively, I could use Tasker's "Kill App".
In certain cases, killing is not the right thing. For example, my Audiobook reader will stay in the Notification bar active in Pause mode. To actually stop it I have to exit via the menu.
By using "Kill App" there might (?) be a danger to loose data (not sure, though) in other Apps when killed. At least when using "Kill App" in root mode, the killing is pretty "aggressive"..
So my question: Is there a way to gracefully close/exit an App without having it to put to the foreground?
Similar to sending a SIGTERM to a process in Linux/Unix? SIGTERM (kill -15...) is giving the process to be killed the chance to clean up before exiting. I am not sure how Android Apps are built.. do they act on SIGTERM at all?
Dan