I have my App which downloads & uploads data from/on the server (I have my WebApp written in Java & hence, used SOAP webservice for the communication between my Android App & Java Web App).
Up till now I've been using
AsyncTask
for calling WebServices to download/upload data.
So far so good with small amount of data being downloaded. But when I download the large amount of data from the server the App crashes.
In reference with the android ref doc.
AsyncTasks should ideally be used for short operations (a few seconds at the most.) If you need to keep threads running for long periods of time, it is highly recommended you use the various APIs provided by the java.util.concurrent pacakge such as Executor, ThreadPoolExecutor and FutureTask.
So I think this is the problem with the AsyncTask being used for longer time interval.
Here is a similar old post
But I am not able to figure it out how to call web services using other threading techniques such as : Thread Pool Executor,Future Task or Executor
Below is my LogCat:
Hey, now there is one more problem . I have used IntentService for those long running Network operations (Downloading). Now As My data is big enough while downloading .Hence, in middle of downloading if internet connection is lost then I have to stop the IntentService which I think I can do using.
stopService(new Intent(MainActivity.this, IntentServiceClass .class));
which calls ,
onDestroy()
of the service. But the Code written in ,
onHandleIntent(Intent intent)
will keep on executing. (Which should not happen).