How to prevent Android OS from closing a background app for memory?

  • Thread starter Thread starter AC Question
  • Start date Start date
A

AC Question

I am crating app which contain one service which keeps running in background .

This services is running in all mobiles but only few mobile ex: Samsung J series
not able running because in this mobile Android OS closing that services.

Can anybody tell the solution for this
 
There is no good way to keep a service alive once the kernel OOM parameters say it need to be closed. You could add a persistent notification and run the app in the foreground, but that's really bad practice.

The problem in this case is likely the custom memory management used by Samsung. More memory is reserved and allocated to system UI services and Samsung apps, and third-party applications are closed by the kernel reaching an out of memory state too early and too often.

If you're correctly creating a service and starting it with startService() there is not much more you can do.
 

Forum statistics

Threads
954,152
Messages
6,960,730
Members
3,162,929
Latest member
mechelle1368