Download
Get the 2.0.0-beta release here.
Getting Started
We're just gonna jump right in here and talk how-to. These instructions require you to have installed Eclipse and the Android SDK, via these instructions or similar. Once you have that, you can do this:
- Create a new Android project or select an existing project
- Copy the Couchbase.zip and couchbase.xml files into the top-level of the project:
- Right-click on couchbase.xml and select Run As > Ant Build (or select it and click the green Run arrow).
- Refresh your project
Your App Code
Now that your project supports Couchbase, starting Couchbase is accomplished by adding a few things to your application's Main Activity.
1. Create an instance of ICouchbaseDelegate, you can implement these methods to respond to Couchbase events:
private final ICouchbaseDelegate couchCallbackHandler = newICouchbaseDelegate() {
@Override
public void couchbaseStarted(String host, int port) color
@Override
public void exit(String error) color
}
2. Declare a ServiceConnection instance to keep a reference to the Couchbase service:
private ServiceConnection couchServiceConnection;
3. Add a method to start Couchbase:
public void startCouchbase() {
CouchbaseMobile couch = newCouchbaseMobile(getBaseContext(), couchCallbackHandler);
couchServiceConnection = couch.startCouchbase();
}
4. Call the startCouchbase method from the appropriate Activity lifecycle methods. For many applications the onCreate method is appropriate:
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
...
startCouchbase();
}
Once Couchbase has started you will get a notification by your delegate callback being called with couchbaseStarted. At that point you have can construct a server and database URLs, and proceed by using high-level libraries like Ektorp.
Client Library
Example Applications
Documentation
Join the Community
- Community Mailing List
- [Web Forums\|/forums/couchbase/mobile|]
- [Report Bugs\|/issues/browse/CBMA|]