SQLite on Android and MongoDB with synchronization

泪湿孤枕 提交于 2019-12-03 16:46:46

There are a few different approaches to consider:

1) Use a database product that implements multi-master or MVCC (Multiversion Concurrency Control) and runs on both Android + your server. There are some examples on the MVCC wikipedia page, with CouchDB being a common solution. There is a TouchDB-Android port which is optimized to run on Android and supports replication to CouchDB.

2) Your requirements may be simple (or unique) enough to warrant rolling your own solution. A common solution would be using SQLite on Android and syncing information to a remote server over a (probably RESTful) API.

It is not essential to use the same database solution on both mobile device and server, but using a similar schema and query language will probably keep you saner.

You may want to take a look at SymmetricDS, I haven't used it myself but I'm considering it.

It currently allows a SQLite DB on Android to sync to a mongoDB backend but currently not in the other direction. Apparently you could create the necessary sync data into the intermediary sync'ing DB for it to work back to your SQLite DB.

There is also an iOS version in the pipeline.

It has a GPL licence so you'll need to pay (unless your app is open source) if you use it commercially.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!