This is a very brief overview and you’ll probably have a bit of reading to do to be able to implement this, the steps are:
- Create an SQLite database to store all data in.
- Implement a
ContentProvider
which provides CRUD access to the database. - Add an account authenticator and add an account (can be a dummy account if you don’t actually use accounts with your application but it’s required for the next step, see http://developer.android.com/training/sync-adapters/creating-authenticator.html).
- Create a
SyncAdapter
to keep the database in sync with the web service.
Your UI should be displaying data from the database rather than calling the web service. There are various ways you can trigger a sync e.g. manually by the user or automatically when data changes. You can use observers to update the UI when data changes too.
solved How to make my app work off line as gmail app on android? [closed]