Reputation: 498
my application uses a service in the mode START_STICKY
,everything work fine,
PROBLEM
Just when my activity Ends, the Service Return START_STICKY from onStartCommand,and destroy it self calling its own onDestroy... after that the service re-start and continue forever, but my problem is with the return from onStartCommand (and self destroy) that causes all my input streams,output streams and the socket close! and thus make the server got exception (java.net.SocketException: Software caused connection abort: socket write error). how may I avoid the onDestroy of the service when closing the activities!?
my code is very separated and big so I ask about the concept, not the coding errors!
Upvotes: 0
Views: 33
Reputation: 1686
You need to start your Service as its own process otherwise, the Service will belong to you application process and when that process is killed, apparently your Service will be killed too. This article will help: http://www.vogella.com/articles/AndroidServices/article.html
Upvotes: 1