Manually Ending The Intentservice Worker Thread
I am having some trouble manually ending the IntentService onHandleIntent method. I am catching an exception which is crucial to the execution of the rest of the thread and I want
Solution 1:
As sonykuba said, finishing the onHandleIntent method stops the Service. So you could do something like this:
publicvoid onHandleIntent {
try {
// ... your code here
} catch(YourException e) {
// do something with the exceptionreturn; // this prevents the rest of the method from execution // and thereby stops the service
}
// rest of your code
}
Solution 2:
IntentService stops automaticlly after finishing OnHandleIntent. There is no need to do it manually.
Read description of method onHandleIntent()
Post a Comment for "Manually Ending The Intentservice Worker Thread"