I’m well aware of how I can communicate with an outside server using Android. Currently I’m using the relatively new AppEngine Connected Android project to do it, and everything works fairly well. The only thing that I’m concerned with is handling downtime for the server (if at all) and internet loss on the client side.
With that in mind, I have the following questions on an implementation:
- What is the standard technique for caching values in a SQLite Database for Android while still trying to constantly receive data from the web-application.
- How can I be sure that I have the most up-to-date information when that information is available.
- How would I wrap up this logic (of determining which one to pull from and whether or not the data is recent) into a
ContentProvider? - Is caching the data even that good of an idea? Or should I simply assume that if the user isn’t connected to the internet, then the information isn’t readily available.
Good news! There’s a android construct built just for doing this kind of stuff, its called a SyncAdapter. This is how all the google apps do database syncing. Plus there’s a great google IO video all about using it! It’s actually one of my favorites. It gives you a nice really high level overview of how to go about keeping remote resources synced with your server using something called REST.