How to store data when there is no connection and synchronize when connection is available
Im actually developing an android application that can connect to MYSQL database on web query it and get latest records. The p开发者_C百科roblem is how to do when there is no connection.. I mean that an employee with an android device would record an order from the customer office but unfortunately there is no connection..How to proceed in such case? How can we store the order locally and synchronise once the connection is available... My problem is the method.. Thanks
I would be solving this problem in following way:
- Always save save/write data to SQLite tables (it would be good if SQLite tables structure would be the same as MySQL ones)
- Check in background
Thread
connection availability - As soon as you get connection - copy all data from SQLite to MySQL
Maybe this is interesting for you to watch. Virgil Dobjanschi explains in detail what barmaley suggests.
精彩评论