Android Question Need advice with sychronize


Licensed User
i build several apps that sychronize with a Webservice and/or FTP Server but lately we have more often a time out problem. The problem is that upload of a photo's take to long and/or the webservice takes to long to sent a responce.

The synchronisation to the server is a b4a Service with a structure like this:
- sent XML data to a WebService (HttpUtils2 version 2.01) and wait for responce if the xml is processed
(we get a massage back if its processed or if something did go wrong)
- Set in sqlite database that the data is processed or handle the error
- Sent next XML data to a WebService and wait
- Set in sqlite database that the data is processed or handle the error
- This do we several 1 to X time
- last step is to upload the photos with FTP (sometimes we use EncodeBase64 instead of FTP)
- if all goes well the service is stopped and we go back to the app.

Problem 1
The problem is that the webservice is very slow with responding (we already set timeout to 1 minute)
and then we get a time out and code goes to next XML message without set the data as processed in the
sqllite database.

Problem 2
The tablet camera are better now a days and the photo's get bigger and bigger (customer request that the resolution of the photo is max resolution) and we had cases that the customer try to sent 100+ photos to the FTP Server with a upload of 50-100k upload. This takes so long the App get a android message not responding and the app crashes.

If we use EncodeBase64 to sent photos to the webservice the websevice is responding very slow also.

Question 1:
What is the best methode to sychronise with slow responding WebService (They wont change the webservice much for us) but we have to wait until the we get a responce from the webservice before
we sent the next set of data? (with testing we noticed that the responce time is regualar between 1 and 2 minutes and sometimes even slower)

Question 2:
What is the best way to sent lot (100+ photos of 2m+ ) of photos to the Server (FTP/EncodeBase64) wihout the app gets a not android not responding message?


Licensed User
Thx DonManfred
The upload is already a service and change it to a background service isnt a problem only have add a function to monitor the progress.

They use the App mostly offline because of bad 3g/4g connection and sync when they are at home/office with Wifi so monitoring that upload
is ready is important for them because they poweroff the tablet when its ready.

But bigest problem for now is the slow responding webservice and dont know a good solution for that.