NOTE: Do not use the source in this repository, only the binary Downloads and instructions
- Android SDK
- Eclipse ADT
-
Create a new Android project or select an existing project
-
Download Couchbase.zip and couchbase.xml into the top-level of the project:
- https://github.com/downloads/mschoch/Android-Couchbase/Couchbase.zip
- https://github.com/downloads/mschoch/Android-Couchbase/couchbase.xml
-
Right-click on couchbase.xml and select Run As > Ant Build
-
Refresh your project
Now that your project supports Couchbase, starting Cocuhbase is accomplished by adding a few things to your application's Main Activity.
- Create an instance of ICouchbaseDelegate, you can implement these methods to respond to Couchbase events
private final ICouchbaseDelegate mCallback = new ICouchbaseDelegate.Stub() { @Override public void couchbaseStarted(String host, int port) {} @Override public void installing(int completed, int total) {} @Override public void exit(String error) {} };
- Declare a ServiceConnection instance to keep a reference to the Couchbase service
private ServiceConnection couchServiceConnection;
- Add a method to start Couchbase
public void startCouchbase() { CouchbaseMobile couch = new CouchbaseMobile(getBaseContext(), mCallback); couchServiceConnection = couch.startCouchbase(); }
- 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(); }
For help or more information please join the Couchbase Mobile Google Group: