Synchronize Android client with remote SQL server database using web service

I implemented an Android application that requires a dataset taken from a SQL Server database. The application receives data that calls WS. After the first WS call, when the application is launched for the first time, I need to update the data in accordance with the change that may occur on the server side (SQL server database). To get this result, I make a WS call at a given frequency to find out if the data in the database has changed. If new data is available, another web service is called to retrieve it.

This solution works fine for mine (I do not require a real-time update). But, I think this solution is too expensive in terms of power consumption, processor consumption and network traffic. Since, I am impressed, this is a very common problem that I would know if there is a general way to deal with it.

0
source share
3 answers

I suggest you use extra fields. Add four columns to your local tables in Android:

  • TRANSACTING_FLAG: set to true when you publish or update this resource on the server.
  • REQUEST_STATE: set this flag to POSTING / UPDATING / DELETING etc.
  • RESULT_CODE: , .
  • TIMESTAMP: , .

: , , , . , . , . , , , . , , " " , .

, . RESTDroid. , .

+1
+1

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


All Articles