I developed an offline dictionary application in android that has local db built in sqlite shipped with it during installation. But the problem is that how to can I update, delete, add new record in the local db of application whenever it connects to the internet?
Is there any specific protocol, technique, pattern or model?
Android Apps will typically use ReST architecture.
A good library to help you with this is Retrofit.
There isn't really a "universal" solution to your problem.
Related
We have build and Android app with sqlite db and a Windows program with JavaFX that can use either Derby db or sqlite db. Synchronization does not want to use a server yes old fashion wire form one device to another. So my question is has anyone found an open source API to accomplish this task? As a novice developer I might add that the perhaps the other fly in the soup is we would like to encrypt the data on both databases. This fly can be optional. The desktop development is using NetBeans and the Android development is the obvious Android Studio.
If anyone has a book or web site suggestion that would be great.
We can consider a NON FREE API with cost as a factor.
I have a question about which database I should use for my android and iOS apps. I have not messed with servers before so please excuse my ignorance.
Anyways, I am developing apps for a website that doesn't have a mobile version. The website has a MySQL database and uses phpMyAdmin as a control panel.
I need to figure out how to hook into the server. I know that java provides full support for SQLite databases and I know that they server hosters can install SQLite on the server for me.
What do you all think? MySQL or SQLite?
You should be using SQLite for any local databases to the Android app (CoreData for iOS).
Any interaction with your websites MySQL database should be handled through API calls.
There is a good PHP framework called Slim PHP that will make building your API extremely simple. It's documented very well. Slim PHP doesn't offer any form of ORM so I'd also recommend integrating with Idiorm/Paris, again their documentation is rather good so you shouldn't have a problem piecing this all together.
Of course you can opt for a larger PHP framework that has all of this in one place, such as Symfony.
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.
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
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!