stopping/clearing IntentService queue when Internet is down?
<p>I'm loading an array of files to be downloaded and i'm starting an IntentService for each of those files. The problem is in the case of Internet connection problems such as if the device is disconnected I will have to somehow clear or stop the IntentService's queue processing. </p>

<p>In my code I have a while loop in which the file is being downloaded. One of the conditions for this loop to run is: checking for Internet Connectivity which I have done using the following code:</p>

<pre><code>public boolean isOnline() {
         ConnectivityManager cm = (ConnectivityManager) getSystemService(Context.CONNECTIVITY_SERVICE);
         if(cm != null){
             return cm.getActiveNetworkInfo().isConnectedOrConnecting(); 
         }
         return false;


 }
</code></pre>

<p>my loop is similiar to the following:</p>

<pre><code>while(.. , isOnline()){
    /// Download file
}
</code></pre>

<p>If I'm now downloading a file in the queue and if the Internet goes down the loop will not run anymore and the IntentService for that file will stop but now if the internet comes back the download will start from the next file in the queue ignoring the last file which we couldn't download. How can I clear the IntentService queue or make the IntentService queue resume the download from where it left.</p>
