I am writing an Android app which must always be running in the background until the user exits it from the app's menu. But now I notice that in Android after some time my app is stopped by itself without user intervention.
Any idea how to make sure my app will always be running in the background?
You need to run a Service of your own. http://developer.android.com/reference/android/app/Service.html
If you need to run at all times, look into a Service
and startForeground
. If you can let your Service
die but get restarted, look into onStartCommand
and START_STICKY
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With