title: Android Image Upload: Use Activity or Service?
body: <p>Currently I use an Activity to upload an image to the web, I'm using AsyncTask and everything is working great. I currently use an Activity to achieve this, basically the activity allows the user to enter a few details, take a picture and then submit, a progress dialog is displayed until a response is received. When on E or G connections the whole process can be quite lengthy (in excess of a minute). Its not possible to finish the activity and return to the previous activity (which is what I want) until  a response is received. </p>
  
  <p>What options do I have. Currently if I press the home button the process works fine and continues to upload, can the application be minimized programmability? . I see many problems with this approach, for example if the activity closes or an error occurs. </p>
  
  <p>The only approach I can think of is to move the actual upload code to a service, gather the information using the activity and allow the activity to start a new service for each upload? I can then notify the user of success or failure using the NotificationManager and handle the re-try in the service.</p>
  
  <p>I noticed that when sharing an image from the gallery to Facebook the activity immediately closes and the user receives feedback via a notification. I'm assuming this approach uses a service to upload the image to Facebook?</p>
  
  <p>Any help / advice would be much appreciated.</p>
  
  <p>Regards</p>