Good afternoon! Maybe my question does not fit perfectly into the criteria because it is more of a doubt whether "it is possible or it is not possible". Here's the problem: I want to create an app in the following scenario: it will set how long the mobile screen goes off after a certain time, even if the app in question is not active. Here's the scenario for a better understanding: The app is installed on the phone, but it's in the Destroy state, inside the app I set it to count from 10:00 p.m. only ... so even with the "not active" app I I want every day after 22hrs it tells how long the screen of the cellphone is not connected (how long the person remained without touching the cell phone) where I would capture this time and store for statistical purposes, in summary would be like an app task that it runs autonomously, almost like the Android OS, all this because I want to create an app that tries to guess how long the user has slept, so the question of the initial time, where it sets "normally I sleep by this schedule", then if the screen is off for more than 2hrs after that time the app will understand that the user is sleeping.
Please respond to me if this is possible so that I end up not injecting time into a project that can not be completed because it is too crazy rsrs. Thanks in advance for the community!