What is the best approach to upload 1000+ records to a server that also contains images for each record from an iOS/Android app? What is the best approach to upload 1000+ records to a server that also contains images for each record from an iOS/Android app? database database

What is the best approach to upload 1000+ records to a server that also contains images for each record from an iOS/Android app?


I guess the best way here is to send each record separetely (if they are not related to each other).

If you have media attachments, sending of each record will take 2 seconds in average, if you uploading via mobile internet with speed ~2 MB/s. If you will send the large batch of records via each request, you must have stable connection for a long period.

You can send each record as multipart request, where parts are record's body and media attachments.

Also you have no need to check for internet connection, or use receiver for catching changes of connection state. You can simply use this libraries for triggering sync requests:

  1. JobScheduler
  2. Firebase JobDispatcher
  3. Evernote android-job


I would suggest to use Firebase database API.It has got nice offline/online/sync implementations.

https://firebase.google.com/docs/database/

And it is possible to read/write the data using Admin SDK for your NodeJS server:

https://firebase.google.com/docs/admin/setup


Save your records in local Db and use ORMs for it. Use Retrofit which provide onSuccess and onFailure method for Webservice calling. To send data to server at regular interval you can use sync adapter.