title: Android: Queue a post until there is a connection
body: <p>hi this is a very simple question but a complicated answer I suspect:</p>
  
  <p>It's called the "mineshaft scenario"</p>
  
  <p>Let me explain : imagine a simple scenario where you had to make a app that can httppost to a webpage even down a mine shaft with no signal. </p>
  
  <p>i.e. How do I try/queue a submit event (HTTPPOST) if there is no connection and then poll the queue periodically (test for presence of connection) until the event can fire.</p>
  
  <p><strong>PS: be warned: please this is about "how to" not a dialogue as to the "wrongness" of this, re: synchronicity or duplicate records or overwriting data from 2 users etc etc.</strong> </p>
  
  <p>Pseudo Code:</p>
  
  <pre><code>try{
     MyHttpFileUploader myupload = new MyHttpFileUploader();
     myupload.Start();
  }
  catch (InternetDownException ex){ //&lt;-- how do I "throw" this in the start method gracefully?
     GlobalQueue.Add(myupload); //&lt;-- how do i set a timer properly that can action this queue (.Start() method) and post messages "when complete" to toast on the main ui thread but otherwise not block the ui whatsoever
  }
  </code></pre>