Mobile application that deals with a weak internet connection

95 Views Asked by At

I want to build an Android application that needs to work with weak internet connectivity or without any internet connectivity.

The main feature of this application is to save and send data like photos and other important information to a server. My problem is regarding the implementation of this system in offline mode and how to build an efficient synchronisation between the server and the client when dealing with a weak internet connection.

Thanks

1

There are 1 best solutions below

0
On

I hope this helps. Probably is not the best solution, but due to the lack of ideas or solutions out there (as you mentioned it) I came with this.
I have something like that on one application. I send data to my main database via webservices, so what I did was I created a table (SQLite) with 3 fields:
1) ServiceFunction (Text)
2) ServiceParameters (Text)
3) Processed (Int, 1 or 0, default 0)

Since my mobile users don't need to know if the record was saved or not, on every event they do I save the webservice method I need to call and its parameters. With this I have a sort of queue for what I have pending to send to my server (MySQL Database, Webservices are on C#)
I have in the background an IntentService running every minute or so processing that "queue". I fetch all the pending records (Processed = 0), execute the webservice method with its parameters and if an error is detected I break the loop and log the problem, if everything is ok, I update the Processed field with 1.

This logic is working without a problem, no data loss or anything on around 150 devices, I send from simple records to image data to be stored on the database (we are not discussing the practices of storing BLOB data on Db or on FS)

I hope this gives you a general idea of what you need to implement on your solution.