I created an app that sets a periodic workmanager (right now, it is scheduled with an interval of 30 minutes). Every 30 minutes, when workmanager is triggered, some conditions are evaluated and, if the result returns TRUE, a specific foreground activity is started. During all this time, my app is destroyed.
The app generally works. But only for an indefinite time. The time is always different. After this time, I start not getting workmanager triggers anymore as expected. For example, tonight my workmanager was working fine for like 16 hours (from about 6pm to 10am). At 10am, workmanager stopped working. Now, I am not getting workmanager triggers since 6 hours (it’s 4pm).
Does someone of you know why this behavior happens and whether it is expected? Is there any workaround to make workmanager more reliable? Do you know any other method I could use to achieve my goal?
edit for everybody: it looks that after I set the interval to 60 minutes, the problem may be gone. I will keep checking it and report on it later.
edit: I am on a Xiomi Redmi Note 8T, currently on Android 11 (but the same happens with Android 10 too)
4