I need this for a custom app designed for a particular company, so it will not be on Google Play. I have an app, which uses about 15 SQLite tables, it needs to be able to work offline and online, so I have to use SQLite to keep information for the offline part. The main idea is that when an user touches a button on Android, an update process is underway. The argument for the update is:
- For each local table I have an asyncTask class that works with the update process according to beer
- in each local SQLite table The "_id" field (Autoincrement) and the "idremote" field must be filled with the MySQL ID (and the remaining fields) of records
- Every time an update is started, the app creates a string in which "idremote" Id contains all the local tables and sending them to the server
- On the server side, receives the string of a PHP file ID and checks in the MySQL table, to see if there is a new ID that is not in the received string
- I process the resulting JSON asyncTask on OnPostExecute and the new record in the SQLite table Insert
So I have 15 AsyncTask class Not that all the above-mentioned similar actions, Ealing with each D specific table from them. I also update the remote template sending new records to MySQL through a single mechanism.
My problem is that I want to view / update when updated / ends That's why I can notify the user of that fact, but since we are talking about many unsuspecting tasks ... who go together ... I do not know how to implement it. When all the asics are done, how to know?
Or is there a better way of doing this work? Update for local / remote tables?
Thanks
The best way to do this is to call it a SyncAdapter
which is designed to synchronize changes in a remote server in the background.
You can find more information here:
You should ignore the "Create Stub Content Provider" section and create a content provider to access your existing SQLite database.
Comments
Post a Comment