I have a background service in my android application.In which a thread listening recent tasks running frequently.My service overrides both onCreate()
and onS
Android can stop any service at any time for any reason. A typical reason is low memory (killing the service to give its memory elsewhere), but I've seen at least a few devices that kill them every X hours regardless. There is no way to ensure you always run. The best you can do is have all your activities try to start your service (in case it isn't running), write your service so it can reload needed data, and set yourself as START_STICKY so if it has enough memory the framework will restart you later.