GithubHelp home page GithubHelp logo

ajrulez / todolite-android Goto Github PK

View Code? Open in Web Editor NEW

This project forked from couchbaselabs/todolite-android

0.0 1.0 0.0 3.24 MB

To-Do list sample app for Couchbase Lite, native Android version

Java 100.00%

todolite-android's Introduction

ToDo Lite for Android

Join the chat at https://gitter.im/couchbase/mobile

A shared todo app that shows how to use the uses the Couchbase Lite Android framework to embed a nonrelational ("NoSQL") document-oriented database in an Android app and sync it with Couchbase Server in a public or private cloud.

The app is available for download in Google Play.

screenshot

Prequisites

Get the code

$ git clone https://github.com/couchbaselabs/ToDoLite-Android.git
$ cd ToDoLite-Android
$ git submodule init && git submodule update

Build and run the app

  • Import the project into your Android Studio by selecting build.gradle or settings.gradle from the root of the project.
  • Run the app using the "play" or "debug" button.

Run the Unit Tests

See Running Unit Tests for Couchbase Lite Android for instructions.

Point to your own Sync Gateway (Optional)

There are three build variants: debug, dev, release.

You can change the build variant in the Build Variants tab in Android Studio:

img

The debug and release variants point to a Sync Gateway instance hosted by Couchbase on a demo server.

If you want to use your own Sync Gateway instance, you can select the dev build variant and make sure to have sync_url_http and sync_url_https set in local.properties in the root directory of the project. For example, if you're running the app on the android emulator it would be:

sync_url_http=http://10.0.2.2:4984/todos/
sync_url_https=https://10.0.2.2:4984/todos/

If you're running the app on a Genymotion emulator, the IP address would be 10.0.3.2. Note the local.properties file is not committed to git. You can now use the dev build variant for developing with SyncGateway running locally and your emulator of choice.

You'll want to use the following Sync Gateway Config

Syncing with Google Cloud Messaging

  • Build Sync Gateway from master and start it with the sync-gateway-config.json file
  • Start the application and make sure it connects to the Sync Gateway.
  • Open the drawer panel and toggle the switcher to GCM. Then, check in the admin UI (http://localhost:4985/_admin/db/todos) that the device token was saved and synced on the profile document:
{
  "device_tokens": [
    "APA91bHE6LfnaKK9DDe9aHLnfim6IfkLLkqvWvFMLsF8BKhv6nEhaNwNo_e9dvdYoWQ2LDFszWhI-B4Dmvvwl8GCbqQ-fpAB-hqGtcheLk48BqnmWJsmQ-1ELlb9v1Hwx4ZzGnzCM7ydNf9ayEinKHnfOXPmG4_Zxw"
  ],
  "name": "James Nocentini",
  "type": "profile",
  "user_id": "1406037206384636",
  "_rev": "2-26d69939231b1e6a07bc3af44fb334dc",
  "_id": "profile:1406037206384636"
}
  • Download the notification worker binary from here and start it from the command line
  • Now the emulators/devices should sync with GCM and you should see a toast message when a notification is received

Note: the source for the notification worker is in the ToDoLite-Notifications repo.

img

Community

If you have any comments or suggestions, please join our mailing list and let us know.

License

Released under the Apache license, 2.0.

Copyright 2011-2014, Couchbase, Inc.

todolite-android's People

Contributors

jamesnocentini avatar tleyden avatar pasin avatar devexter avatar hideki avatar

Watchers

James Cloos 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.