title: android design considerations: AsyncTask vs Service (IntentService?)
body: <p>I'm designing an android app which will need to do the following steps:</p>
  
  <ol>
  <li>user pushes a button or otherwise indicates to "sync data".</li>
  <li>sync process will use REST web services to move data to and from the server.</li>
  <li>the data will be stored locally in a sqlite database.</li>
  <li>the sync process should provide status updates/messages to the UI </li>
  <li>the user should not be allowed to wander off to other parts of the application and do more work during the sync process.</li>
  </ol>
  
  <p>The first time the sync process runs, it may take 10-20 minutes.
  After the initial sync, less data will be transferred and stored and
  I expect the process to take 1-2 minutes or less.</p>
  
  <p>I've been doing a lot of reading about android's <code>AsyncTask</code> and various examples of using a Service ... But I don't fully understand the design considerations and trade-offs of choosing one design over the other.  I currently have my demo project stubbed out using an AsyncTask.  After watching (most of) Developing Android REST client applications:  <a href="http://code.google.com/events/io/2010/sessions/developing-RESTful-android-apps.html#" rel="noreferrer">http://code.google.com/events/io/2010/sessions/developing-RESTful-android-apps.html#</a> I'm left confused the design patterns described here feel overly
  complex, perhaps because I just "don't get it" yet.</p>
  
  <p>I come from a java, spring, web and desktop application background.  Thinking and designing in terms of a handheld device is quite new to me. (What happens when the screen layout is changed? What happens when the phone rings while I'm running a sync?)  Taking 2 steps back, if the initial sync IS going to be such a long running process, is there a better way for me to think about the problem->solution, the user experience, the user expectations of an application running on a phone? </p>
  
  <p>Would love to hear from some more experienced android developers out there who have already wrestled with these questions.</p>