I read this about flags in an article:
When a START_STICKY service is killed by system, it restarts with following arguments
If there is any pending intent to be delivered, it is passed to onStartCommand otherwise null is passed.
If service is killed before completing onStartCommand, next time service if restarted with flags = Service.START_FLAG_RETRY
In this case, service is only started if these is any pending intent to be delivered.
It is same as START_STICKY with following differences
Service is restarted with last intent passed to service.
On restarting, Service.START_FLAG_REDELIVERY is passed to onStartCommand flag.
what is the meaning of
pending intent in here? from what i know, context.StartService() can be called a million times and will still start a service only once, so how would that really work? Like, do these calls get simply ignored if a service is already running or do they get stored in some kind of system queue? and if the system decided to kill my service, would it consider all the previous calls made to context.sStartService() made via the previously opened activity?
Side question 1 > killing the app from settings >> force stop will completely kill all the processes and running components of the app right? will these flags matter then?
Side question 2 > why would anyone want to return START_NON_STICKY ? from the definition , this looks like a flag telling the system to not start a service at all