简体   繁体   中英

How to make an android app work in offline mode in android

I want to know how i can make my app work in offline mode and store the data on a local database on the android device.

I am using mongodb database and fetching the data by using JSON Parsing.

What should i use to make my app run in offline mode and also update the changes made on the server ?

Which tools should i use ,also which is the best and easy method to implement this?

Thanks in advance.

  1. first you create local SQLite Date Base
  2. in that create one extra column like "noNet" ...
  3. In this column you save your data when phone in offline mode and then send data to web server when phone is online

This question is a bit older now, but I'd like to add what I believe is a good architecture approach to solving this.

Take a look at the tech talk given by Yigit and Adam at the Android Dev summit. https://plus.google.com/+AndroidDevelopers/posts/3C4GPowmWLb

Seems the core components are:

Those 3 together get you most of what you will probably need. Their tech talk (first link above) really details these things better, and there's a final example application you can take a look at as well: https://github.com/yigit/dev-summit-architecture-demo

If you have an option, you can go for couchdb or couchbase which provide couchlite for android and sync is taken care by itself.

you can also refer this thread here SQLite on Android and MongoDB with synchronization

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM