• After 15+ years, we've made a big change: Android Forums is now Early Bird Club. Learn more here.

Apps How to Prevent Android os kill process(want app continuously running)

Hello Friend,

I am developing chatting app in which i have to run my app continuously in background also. but unfortunately sometime my app kill by Android OS. and i have to relogin. Is there any way to run my app continuously in background. Some App is available on Google play which is running in background.

Please help me to run my app continuously .
Thanks in Advance
 
Welcome to the AndroidForums, amitsharma_ujj :).

I'm not sure you'll be able to...my experience is that Android may kill a background process at any time.

I have an app that has a background service and all I could do was try to gracefully recover from the termination.

There may indeed be methods that I'm not aware of, but short of having the app in the foreground, I'm afraid Android might keep killing your background process.

Maybe someone else with other thoughts or information will chime in.

Anyway, thanks for signing-up with us here at AF.
 
Upvote 0
You can consider using startForeground in your service. As the docu says:

A started service can use the startForeground(int, Notification) API to put the service in a foreground state, where the system considers it to be something the user is actively aware of and thus not a candidate for killing when low on memory

The Service will still run in background with an icon in notification area.
 
  • Like
Reactions: scary alien
Upvote 0

BEST TECH IN 2023

We've been tracking upcoming products and ranking the best tech since 2007. Thanks for trusting our opinion: we get rewarded through affiliate links that earn us a commission and we invite you to learn more about us.

Smartphones