Thank you very much for answering me, now I will know it. I don't know a lot of things, like what happens with the application at code level and because of that I can ask silly questions, I apologize in advance for that, I'm trying to learn more and more.
Can we say that when the application is closed and when it is open but not in the foreground are the same state from a code perspective? That is, on Android 8+, in both cases the app does not show any activity?
Is it possible to add a "App not running" trigger ? This trigger would work if the app is not presenting any activity and, theoretically, this could be used instead of closing the app. That is, this trigger would constantly check if the application is running in the foreground and in the background, and if the application is not running in both cases, the trigger would work.