This application provides the fastest way to deploy a CouchApp to an Android device using Couchbase Mobile and Apache Callback (formerly PhoneGap).
This project requires the latest version of the Android SDK. If you already have the SDK tools, you can upgrade by running android update sdk
, if you don't have them, you can install via this link
These instructions are divided into two sections, the first describes the development mode. In this mode you can continually couchapp push your changes in for test. The second describes distribution mode where you package your application for distribution.
-
Clone the couchbaselabs/TouchDB-Android repository
This application has been tested with commit/59ddf37d6e7bb819f969909971c202eab8c44119
run the TouchDB-Android-TestApp
-
Clone this repository
-
Build this application, using Eclipse
Debug As --> Android Application
-
Install/Launch this application on your device/emulator
The app should now be installed, waiting on a debugger breakpoint
-
TouchDB is now active on the device, so you can install your couchapp.
You will need to know the ip address of your device. If a Terminal Emulator is installed on the device type: netstat
You should see the LISTEN process running on port 8888 and other services on the ip address of your device
-
From within your CouchApp project directory, run the following command to install your couchapp on the device.
cd path_to_project/Android-TouchDB-Cordova/examples/CordovaCouchApp/couchapp
couchapp push http://ip_address_of_your_device:8888/ccap e.g. couchapp push http://192.168.0.6:8888/ccap
Note: ddoc name and db specified in res/raw/cordovacouchapp.properties. If you are using a different couchapp, check its ddoc name in your couchapp's _id file
-
In a browser, test the couchapp installation went OK
http://192.168.0.6:8888/ccap/_design/cordovacouchapp/index.html
-
Allow eclipse debug to complete. Re-run the android app from eclipse or directly on the device
This should now work. It is not necessary to use debug and install the couchapp after the first time, since the couchapp is persistent.
-
Compact your database
curl -X POST -H "Content-Type: application/json" http://localhost:8984/couchapp/_compact
-
Copy the database off the device and into this Android application's assets directory:
adb pull /mnt/sdcard/Android/data/com.couchbase.callback/db/couchapp.couch assets
-
Repackage your application with the database file included
ant debug
-
Reinstall the application to launch the CouchApp
adb uninstall com.couchbase.callback
adb install bin/AndroidCouchbaseCallback-debug.apk
adb shell am start -n com.couchbase.callback/.AndroidCouchbaseCallback
Portions under Apache, Erlang, and other licenses.
The overall package is released under the Apache license, 2.0.
Copyright 2011-2012, Couchbase, Inc.