Sync data on device with server?

I am working on an application that reads the xml file generated on the server and synchronizes the local database on the device. I am trying to create a synchronization manager that contains all the fields available on the server, and adds these fields for synchronization, like a basket. And after adding all the fields Synchronize all the fields added to the basket.

I have three questions:

  • What would be the best way to do this?

  • Can I read a specific tag in xml without parsing the entire XML file on the server?

  • A condition for comparing fields in a local database?

+4
source share
1 answer

I did something similar. I donโ€™t know what programming language you are programming in, but I use QT. So I wanted to connect to the database. I made this approach. Write SQL scripts that will process your XML code. For example, you want to return only a certain part of the database, and not all. Then I wrote PHP scripts as part and a mid-level application, something to handle the connection and send certain message parameters that tell me what to send back or what to do in the database. Then I made a script to convert everything to XML and send it back to QT and present the data in my GUI. Using scripts when working with a database is good, because you can change it to any desired database. For example, I used it for an Oracle database. Since the oracle database for android does not have automatic synchronization, I made my scripts handle all of this. I hope my example helped you understand the approach I used. I canโ€™t say that 100% is the right way, but it works correctly for me. Good luck

+1
source

Source: https://habr.com/ru/post/1393907/


All Articles