Antonio Henrique Antonio Henrique - 3 years ago 77
Android Question

Check if need to update the local data(Web Service)

I have a android app and i need to improve both performance and request internet.
I have also a web service in .net.

When i enter in profile of a person i always need to download the profile again, but i want verify if i need download the profile(new data).

I thinking make a Date column and whenever someone modifies the profile, update the column Date.
In android, load from localDB and verify if "update date" of local is the same from remote db(web service) and if not download data from api.

its the right way to do?
what is a better approach?
maybe using a int to verify "the version of a profile"?

thank you

Answer Source

You can't know on local device what is happening on web server without contacting it. I would cache profile in android memory cache or database, and call web service in background to check for new data.

I would also cache profile on server, on web service because it will help performance to other consumers of web service if you have it (like web app). When someone change profile(inside your POST or PUT method don't forget to invalidate cache). When you receive new profile from web service update database or cache it then again in android.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download