I've a Server application running with data storage in MySQL.
Later some time, we happened to build a simple Android app for data updation to the server. So far so good.
But, Since with the issues we've been facing with network connectivity often, We wanted to maintain the data completely offline during poor network connectivity and sync it when there is proper network.
1) How I'm doing this is, Let's say if we have five tables in MySql from the server side, Then same tables with same structure I've build in SQLite in my Android App so that the user should able to use the app as if theresn't any difference. I've an additionlal independent table added in SQLite for offline updates which has to be synced.
2) Everytime I login into the app with proper network, I'm truncating all the tables in SQLite and fetching new fresh data from server and storing. So here, between login and landing page, since server has much data, data fetching and storing taking a lot of time in the app. Here I don't know any other way to achieve the performance.
So Here considering the above points, Is there a better way fetch the data from the server and sync with existed database in SQLite rather than truncating and restroring all the data from server?
I've been looking for the solution so eagerly. Please can someone helpout with good explanation or reference?