Prevent Android from closing my service/thread
<p>I have an app that uses a service in the background to do some upload/download operations.
These operations can take some time, depending on the user selection (amount and size of files). </p>

<p>While with my device (nexus s) and in the testing emulator, all works as planned, I am getting reports from users that the operation gets stuck sometimes when choosing to upload/download big data.</p>

<p>The operation is done using a thread that runs in a background service. My guess is that the OS sometimes kills the thread and/or service on devices with low memory.</p>

<p>In the service onStartCommand() function I am raising the thread that will do the operation (the data to handle comes within the intent), then I am returning START_NOT_STICKY.
At the activity I am using startService(i), no binding is done.</p>

<p>How can prevent this? How can I ensure the system will not kill either my service or thread?</p>
