c# - Only update data in local database from web service if the data is new -


i have coded c# web api 2 web service, , wanting retrieve data in android application have coded.

i wish have local sql database on android device stores data web service.

whenever data used in android application, wish check see if local database data date, , if isn't, wish retrieve latest data web service.

i thinking of following:

  1. each time data saved local database, save integer value update number.
  2. whenever data required, retrieve latest update number local database, send request web service update number, , return data if web service data has newer update number.

would work well? there better approach problem above idea? there disadvantages or errors occur?

thanks in advance.

i did same thing synchronization algorithm. it's this. web service methods gets datetime parameters, web service sends objects created or modified after time.

on mobile side, keep synchronization start time, , each synchronization, send previous sync start time. (by way, ask date server before sync starts)

i dont keep sync end time, because of data may modified after sync started.


Comments

Popular posts from this blog

javascript - Jquery show_hide, what to add in order to make the page scroll to the bottom of the hidden field once button is clicked -

python - Django-cities exits with "killed" -

python - How to get a widget position inside it's layout in Kivy? -