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
You have this code in your Service.onStartCommand()
:
if(intent != null){
You do realize that if Android kills the process hosting your Service
, it will create a new process and create a new instance of your Service
and restart it, calling onCreate()
and then calling onStartCommand()
with a null
Intent
. This is probably what is happening and why you think that onStartCommand()
is not being called.