I want to start a Service for a long running location fetching task. I've chosen to use a foreground service for this task. I want this service to run in the background thread.
Now, after searching a bit, I have decided to start a new thread in onStart()
of the Service and not the Activity itself. I don't want any memory leaks with the Thread having reference of Activity. I am fine with Activity being destroyed.
My question is, on which Thread is onStartCommand()
is called? What will happen when I try to start the Service again?
I am not very experienced when it comes to threading, please point out anything I'm missing or am wrong about.