I have developed an application that does require to do constant network activity. This Activity does the network connections thru an AsyncTask, sometime this work being done in background (application not having focus). My application sometimes gets killed after 30 mins, even if the system does not seem to lack resources (memory).
I have read the Activity life cycle in the Application Fundamentals section on developer.android.com, but can't find an answer. What would be the proper way to programmatically prevent my Activty to get killed.
Thank you.
You should use a service instead of using an Activity to do work in the background.
Does your application have to be an activity? Can it utilize a background service?
http://developer.android.com/reference/android/app/Service.html#ServiceLifecycle
If you use a Service and make sure it stays active (by first starting it and simply not stopping it) the application wont be killed (unless it's extremely low on memory of course).