Skip to content

null2/Couchbase-Lite-PhoneGap-Plugin

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

PhoneGap plugin for Couchbase Lite

Couchbase Lite is an embedded JSON database for occasionally connected devices. It syncs data in the background, so users can collaborate across devices. There is an event based _changes JSON feed API so you can drive data-binding UI frameworks like Sencha and Backbone to reflect remote updates interactively.

It works with native code as well as Cordova / PhoneGap on iOS and Android (you can even sync with Mac desktops), so it doesn't matter where your users are, they can work with the data, and as soon as they get back online, everyone will see their changes.

If you wanna know everything about the PhoneGap plugin system the best docs right now are on Raymond Camden's blog

Quick start

You install LiteGap into your PhoneGap app using the PhoneGap command line tools and this command (where $PLATFORM is either ios or android):

npm install -g phonegap
phonegap create MyPhoneGapApp 
cd MyPhoneGapApp/
phonegap local plugin add https://github.com/couchbaselabs/Couchbase-Lite-PhoneGap-Plugin.git
phonegap run $PLATFORM

Congrats, you got to hello world. If you want to get awesome, do this:

rm -rf www
git clone https://github.com/couchbaselabs/TodoLite-PhoneGap www
phonegap run $PLATFORM

You should see a cool todo app in your simulator or device.

So far LiteGap has only been tested with PhoneGap 2.9 and 3.0 apps. (ARC-enabled on iOS 6, and Android API level 11+) If you want to send pull requests, please modify the code in this repo.

Architecture

This is where LiteGap fits in the picture:

architecture.png

Note: your JavaScript code can also directly communicate with Couchbase Lite over a Javascript<->Native bridge, to ask it what URL it has launched on for subsequent XHR access

Note: Couchbase-Lite is capable of syncing with Couchbase Server or Apache CouchDB databases running in the cloud, as shown here

Where to go from here

There's an example chat app with PhoneGap that illustrates the channel sync API. You can read more about the app here.

If you made it this far, you are now ready to build your custom PhoneGap App by editing the HTML, CSS, and Javascript files under the www directory. Your same application code will work on both the iOS and Android platforms!

You might want to start with this API reference and this API cheat sheet. (For REST we use a 90% similar API as Apache CouchDB -- we'll have docs of our exact API in the next few months.)

About

Plugin to install Couchbase Lite in your PhoneGap app on iOS or Android

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • C 45.6%
  • Objective-C 41.7%
  • C++ 11.1%
  • Java 1.4%
  • JavaScript 0.2%