Suppose I have code in the onStart() handler of my Service to launch a thread to do some stuff and then call stopSelf().
stopSelf() gets called before the thread finishes. What exactly happens?
I've tested this out myself and my thread continues to execute until it is finished. Does Android hear the stopSelf() call, but postpone it until the thread is finished?
@Override
public void onStart(Intent intent, int startid) {
new Thread(new Runnable() {
public void run() {
// TODO some long running operation
}
}).start();
stopSelf();
}