I know when Androids kills a service onDestroy() is not necessarily be called (I mean really killed not stopping this service properly). I have a foreground service which starts an async task and I have to ensure to cancel the running task when the service will be killed. The service and the async task run in the same process together with the activity being used to start the service.
My question is now how to cancel this task when I cannot rely on onDestroy() will be called? It is possible at all that Android will kill the single service and leave the process and the task running or will Android only kill the whole process? The last one would be ok for me because this will also ensure that the task stops.
See docs here: http://developer.android.com/reference/android/app/Service.html
therefore if your both AsyncTask and service share the process, both will go down.