Giter Club home page Giter Club logo

android-couchbase-callback's Introduction

Android Couchbase Callback

This application provides the fastest way to deploy a CouchApp to an Android device using Couchbase Mobile and Apache Callback (formerly PhoneGap).

Requirements

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

Getting Started

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.

Development

  1. Clone this repository

  2. Create a local.properties pointing to your Android SDK

    sdk.dir=...

  3. Build this application, either using eclipse or command line tools

    ant debug

  4. Install/Launch this application on your device/emulator

    adb install bin/AndroidCouchbaseCallback-debug.apk

    adb shell am start -n com.couchbase.callback/.AndroidCouchbaseCallback

  5. Couchbase Mobile is now running, you should see now see instructions on screen install your CouchApp.

  6. Forward the Couchbase Mobile from the device to your development machine (the Couchbase port is dynamic and is shown on the screen)

    adb forward tcp:8984 tcp:<value displayed on your screen>

  7. From within your CouchApp project directory, run the following command to install your couchapp on the device.

    couchapp push . http://localhost:8984/couchapp

  8. Refresh the list of CouchApps and navigate to your applicaiton

Distribution

  1. Compact your database

    curl -X POST -H "Content-Type: application/json" http://localhost:8984/couchapp/_compact

  2. 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

  3. Repackage your application with the database file included

    ant debug

  4. 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

Examples

Android Couchbase Callback now includes a couple of sample applications to help you get started.

Assumptions

A few assumptions are currently made to reduce the number of options that must be configured to get started. Currently these can only be changed by modifying the code.

  • The name of the database can be anything (couchapp is used in the examples above). BUT, the design document must have the same name.

Further Customizations

  • Change the name and package of your application

    Refactor name and package of ExampleAppActivity to suit your needs

  • Provide your own custom splash screen

    Override the getSplashScreenDrawable() method to point to your splash screen image

Frequently Asked Questions

Q: When I start my application the splash screen shows for a long time, then I get the message "Application Error: The connection to the server was unsuccessful." In the background behind this message I now see my application. But when I press OK, the application exits. What is going on?

A: Most likely your application is loading a resource (something like the _chagnes feed) and this causes the PhoneGap container to fail to recognize that the page has loaded. The fix is simple, add a function to your application that listens for the "deviceReady" event and start your work after this event fires. For example:

document.addEventListener("deviceready", onDeviceReady, false);

function onDeviceReady() {
    //  start listenting to changes feed here
}

We are still looking for a better approach to this problem.

TODO

  • spoof a call to onPageFinished so that phonegap paints the screen even if a long ajax call happens before onload.

License

Portions under Apache, Erlang, and other licenses.

The overall package is released under the Apache license, 2.0.

Copyright 2011-2012, Couchbase, Inc.

android-couchbase-callback's People

Contributors

jchris avatar mschoch avatar vmx avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.