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
Related
I am new to multi-device development in Delphi and I have a basic VCL background. I have worked with multiple projects that use locally stored databases for their functions etc.
Coding is a hobby and I want to learn more about mobile app development for personal usage. I am busy writing a simple application that serves as a scoring system for a card game that we invented. I am currently using SQLite local database to store data.
I am now looking for a way to have a single database that multiple devices can access so that any one of our android smartphones can run the application and interact with the data in that database.
At this stage, I don't really have extensive knowledge about what I am talking about and I want some advice regarding this problem. Is a single database the best solution? Is there perhaps a different approach?
I am familiar with basic FireDac syntax (TFDConnection, TFDQuery, and TFDTable), so I would prefer maybe keeping a FireDac infrastructure if possible.
I would prefer the solution to not be too complicated :)
I do hope that I presented the problem clearly. Please ask if something sounds unclear - I will try my best to elaborate.
I am using Delphi 10.3 (Community Edition)
There are many solutions to this problem. I won't expose all possibles but only the one I think is best:
You need a server somewhere in the cloud to keep data from different devices and you have to make your application communicate with that server. You can build server side with Delphi, or other tool.
I recommend a REST architecture over HTTPS using JSON format to send/receive data to/from devices.
Delphi has everything required to build both client (Your devices) and server side. Not sure for Community Edition. If not included in CE, you may use third party libraries to accomplish the same task.
You next step is to think about that solution, do some research by yourself, write some code and when you are stuck, ask another question on StackOverflow.
I think question title is self explanatory, however following are more details
Background
I am developing one turn based android game with the help of Firebase realtime database. Concept is very simple, all players are connected to single room which I create by pushing into firebase database. Now every player attaches child value listener to that node. Now I can update game status in this node and everyone will get update in real time.
Problem
During development phase, I am still trying out different ways to structuring this data and implementing in android client. I am not working on any company or enterprise hence I have to use my own mobile internet (where internet data is costly). Plus many times I am in area where there is no internet connectivity. This reduces amount of time spent on testing any network related testing.
Question
Is there way I can simulate (or emulate) firebase database locally ? So that once it is working fine, I can test it on real network ? Any ideas or hints regarding this will be helpful.
It sounds like you probably want to try firebase-server. It is basically a replacement Real-Time Database server that you can run locally.
You need to edit your OS's hosts file to make a 3-part domain name (like localhost.firebaseio.test) resolve to localhost, because of some weird restrictions built into the Firebase client libraries. Some people have found a way around this by injecting mocks into the client library, but this never worked for me; I think it only worked in an old version.
Note that this is NOT the officially recommended way to write unit tests; it's considered better to totally mock out the Firebase client library. It can be quite useful for integration tests, though.
There's a useful thread here that covers some testing questions.
You can use the Firebase Local Emulator Suite it has many modules (including the Realtime Database). Check their official docs here:
https://firebase.google.com/docs/emulator-suite/connect_and_prototype?database=RTDB
I'm a complete beginner with mobile development. A friend of mine approached me with a project idea, asking me if it was possible to do it. The way I see it, it is a mobile app that needs to read and write data on a database in order to write inspection reports on the job of various staff members.
I told that friend that I would check how mobile development works first and would try to create a prototype to present. I've asked and Android is the main platform that is desired, so I've tried working with Android Studio and it is pretty straight forward up to now.
So, now I'm wondering what is the proper way to sync mobile apps with the database. Last time I worked with a database in a project we had multiple clients connecting to a server to play some small game together and the server would access the database and send the data back to the client through the network connection. So, I was wondering if a mobile app was supposed to use this communication structure or would simply talk directly to the database instead of a server.
The structure I have in mind:
Is this an acceptable structure? Or am I thinking of this the wrong way?
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.
Im Trying to use CouchDb as a NoSQL database and my main purpose is to create an application on android which use couchDB instead of sqlite! And I want to use this database locally , so with no server connection!
I have seen that you need to buy this on android market to use it! I'm wondering if I'm going to use this should all the users of my application by couchDB first in android market to be able to use my application?
or somehow it will be included? How does this thing work? Is there anyway that I can skip buying it and include this technology in my own application?
And please let me know if there is some other NoSQL that I can use on android!
Thanks for your help in advance.
I don't think you need to purchse it to use it, as it is an open source library covered by the Apache license.
Speaking of NoSQL I've successfully used both NeoDatis and db4o in the Android environment. Both of these libraries are object databases and are surprisingly fast and easy to use. In fact, the claim is that they are faster than ORM/Relation Databases. I think they are a great fit for a low-user (1 user) low bandwidth environment.
Here's an example of db4o in Android:
http://java.dzone.com/articles/using-db4o-android-application
By the way, db4o is open source, but GPL, which makes it a difficult license to integrate into non-GPL products. They also have a pay-license version.
You probably want to look at https://github.com/couchbaselabs/TouchDB-Android
This is an embeddable Java library that wraps SQLite, so it is fast, native, and lightweight.
It syncs with Apache CouchDB so it has the offline mode you want. It also has a REST/JSON api very similar to CouchDB.
Enjoy!