Android Question My app is stopped / killed


Active Member
Licensed User
Hi all .

I have an app that is supposed to run 24/7 .
But i think OS is killing it .

I have setup the tablet ( Samsung ) with appropriate settings ( battery savings etc ) .
The tablet is always on and connected to power .

And i have taken part of code that i found here on the forum to prevent app from closing .

Fx I have put in these lines:

Service.AutomaticForegroundMode = Service.AUTOMATIC_FOREGROUND_ALWAYS
And i have tryed to change things here and there but it still keeps turning my app off.

Is there anything to do to prevent Android from killing my app ?
Or shall i restart app by timer or anything else .


Well-Known Member
Licensed User
Some devices have both a "Power Savings" option that you can turn on or off, along with a separate section that you can "whitelist" a particular app to NOT be power optimized. So I would see if you can whilelist you particular app.

You could also try making the app a "kiosk" app:

But in the end, there may be no way to make the app truly run 24/7 on all devices.
Last edited:


Active Member
Licensed User
Thanks for answering JohnC , I have done all settings that i can find ( Power savings etc ).
It did not help . Ihave stillthe same problem .

I have one Activity and one service .
And i also use Google maps App and start it from my app ( With my service still running in the back . )

If i restart my app lets say once or twice every day/night , can that help ?