- Android is not designed to run apps for long periods of time .
From a previous forum discussion
- Google revised how long an app can ‘work’ continuously since Android 8. It is not possible to keep alive an app in background or otherwise for a long time (. eg your one or two days).
A few months ago there was a discussion about long term use of a plugged in Android and discussed all the reasons why apps cannot run for long term; essentially because of ‘safeguards’ in the Android system libraries. Sorry, I cannot find it. Perhaps one of the other moderators can.
Your issue is your app/android device shuts down because the Android operating system tells it to. Any way to defeat that is a hack. Keep the device charger plugged in, use a StayAwake routine, limit the battery protections, or run your app on your PC using a games type emulator like BlueStacks (not a nice solution) etc may be the best that is possible