0

I am working on an android application which works offline as well as online. It supports uploading picture, audio & video files.

Now when the user wants to upload a media file, it needs internet. So I want to maintain a request queue which fires all HTTP requests once it detects active Internet connection.

My solution : 1. To maintain an XML file. 2. Write it whenever a new request is created with appropriate data 3. Everytime intenet connection comes parse this XML file and shoot requests asynchronously.

Doubts 1. Is this the best way to go about this? 2. I will have to keep polling for an active internet connection. 3. More importantly, is there any library which can handle this for me?

Note : I am using Volley library but its not suited for large file uploads. Plus it does not have a feature of preserving requests till internet is available.

Abhinav
  • 722
  • 2
  • 11
  • 27
  • Say there are 15 requests in your xml file and during an internet connection interval five requests are done successfully. How would you go the next time internet is available? How will you not do the first five again? – greenapps May 07 '15 at 11:29
  • @greenapps : after a successful request I will update the XML with a flag. – Abhinav May 07 '15 at 15:31

1 Answers1

0

As you are uploading large files mostly picture, audio & video files are in Mb's so better you use multipart file upload . Currently you are writing pending operations in xml file where you need to parse it always while reading for pending operations, for doing the same you can use local database table with each operations status. In table you can keep local URI of files whether it may be audio/video or any with status as pending/completed etc.

As you are having concern that have to keep checking for INTERNET connectivity continuously for this please check link 1 and link 2

Community
  • 1
  • 1
Narendra
  • 609
  • 1
  • 12
  • 28