How to keep an Android Service running?

Keep running android service continuously

  • How to keep running my android service if my app is not running ?

  • Answer:

    Just dont call stopSelf(); inside service or context.stopService(new Intent(context, YourService.class)); with in your application and it will not finish your service till the Android meets low memory situations or get restarted.

vishwa at Stack Overflow Visit the source

Was this solution helpful to you?

Other answers

In the onStartCommand() method in your Service, you will want to return the value START_STICKY. This tells the system to keep running your service until either stopSelf() or stopService(YourService) is called. The http://developer.android.com/reference/android/app/Service.html discuss this in lots more detail/precision.

mfrankli

Related Q & A:

Just Added Q & A:

Find solution

For every problem there is a solution! Proved by Solucija.

  • Got an issue and looking for advice?

  • Ask Solucija to search every corner of the Web for help.

  • Get workable solutions and helpful tips in a moment.

Just ask Solucija about an issue you face and immediately get a list of ready solutions, answers and tips from other Internet users. We always provide the most suitable and complete answer to your question at the top, along with a few good alternatives below.