SQLite on Android and MongoDB with synchronization - android

Is it possible to use SQLite on Android and a NoSQL database like MongoDB on the server, with 2-way data replication/synchronization between the two? Or is it best to either use SQL on both ends, or NoSQL on both ends, but not mixed?

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.

Related

serverside database for iOS and Android app

I am writing an iOS app. It will store details of something on a server somewhere.
I will write an Android app that will offer the same functionality.
I want to access the same database and retrieve the same data no matter whether it is the iOS or Android app being used.
I would appreciate some "keywords" for a technology that can abstract the back end data store so be something common for both iOS and Android.
If there is an example out there on GitHub a link would help me
Thank you
You can use any database that meets your data modeling needs and performance requirements, which one you chose should depend on the structure of your data. What you should be doing is building a shared middle tier server that persists your data and provides it to your iOS and Android clients. You probably want to pass the data between the client and the server as JSON documents using the http protocol. This is generally known as a REST api though you have to follow certain design principles to really be a REST api.
You could write your server side code in Swift, Java or Kotlin. This would allow you to reuse some code on either iOS or Android depending on which language you chose. You could instead use Xamarin/.NET Core to write the server and both clients in C# (or F#) which would maximize your code reuse.
If you don't need or want to use a relational database, you could use MongoDB or a similar JSON document store. You could pass those JSON documents directly to your clients. That would reduce the amount of server side code you need to write.
Here is a good link for using Microsoft Azure Cosmos DB. there are loads of samples and best practices. Information on how to secure the database. how to use partitioning correctly. Cosmos DB is really easy to implement as you don't need an ORM. it has everything built in. I am using Cosmos DB for Xamarin app I am building. It is working great so far. The best thing about it is you can scale up or down pretty easily from the azure portal. below is a good introduction and all the samples you need.
Introduction
Getting Started
Samples
Hope this helps.

Android local SQLite sync with Firebase

I have an app where the default option is to store user data as a local SQLite database, however, I want to add the option if the user wants to sign in and transfer the local database to an online database so it can be accessed on multiple devices.
I don't have much experience with cloud storage solution so any advice would be really appreciated. Is for my application the Firebase Real-time Database the best online solution or is there another approach I should look into?
Firebase's real-time database is indeed one of the best solutions for your problem. It has a generous free plan and is well integrated into Android Studio.
And if your data structure is simple enough, you can drop SQLite altogether and use Firebase's offline storage. This will allow Firebase to automatically handle syncing of offline data for you(syncing is usually painful to implement by yourself).
Alternatively, you could build your own web app and expose a REST API to your android application. This gives you the advantage of having control over everything. I would however not recommend this because of the amount of knowledge and time required.

Local DB on Android sync to backend server? What are the options?

Local DB always sync to remote server sounds a great idea, because you get the responsiveness for using local DB, but also get sync crossing devices.
But can anybody talk about their experiences with couchbase on Android?
https://github.com/couchbase/Android-Couchbase/
What are other options out there? Cloudant?
Look at Touch-DB Android. It's more compact than Android-Couchbase and is still regularly updated and maintained (I believe the main contributor is working on a big release, which is why the last update we two months ago). The framework is built on top of Ektorp and emulates a CouchDB database on your Android device.
Replication to and from a remote database is fairly intuitive and easy to set-up.
I use CloudAnt as my remote back end for my Android game.
I can tell you that in general, it works. e.g. I have an android app that syncs with iriscouch.com. But you might want to ask a more specific question.
iBoxDB is another option. It is a lightweight database for java. You can customize replication.
https://github.com/iboxdb/forjava

What databases/datastores have client data sync support for iOS and Android?

It seems most apps are writing custom logic to sync/replicate cloud data, or using a platform locked service like iCloud.
What cross platform data sync solutions are out there besides roll your own? By "solution" I mean well tested combinations of server and client components.
The two I know of are:
CouchBase Mobile (CouchDB on server, CouchDB on device)
Microsoft Sync Framework (SQL Server on server, SQLite on device)
I know these are quite different data stores, but any data solution that is generalized for many problem types could potentially reduce some wheel reinventing. For example I may need NoSQL for one app and relational for another.
Any other options besides these two?
Sybase SQL Anywhere Studio has UltraLite database as a part.
This database has versions running on iOS, Android, Blackberry, and lets you synchronize through HTTP/HTTPS

How to do bidirectional sync between Android SQLite and SQL Server

Hello, I want to know if there is any way to synchronize my SQLite database in Android to a SQL Server database in the main server in an automated way.
I'm new to Android development and I've been using SQL Server replication in the past with my Windows Mobile apps which provides me a lot of features like conflict detection and resolution. I want to know if there's something similar to SQL Server replication in Android or something like that.
Thanks for your help...
No, this cannot be done easily. There is, however, an alternative storage method like CouchDB which provides automatic synchronization with multiple other databases.

Categories

Resources