developing for offline first mobile experiences
TRANSCRIPT
©2015 Couchbase Inc. 1
Nic Raboy, Developer Advocate at Couchbase
Developing For Offline First Mobile Experiences
©2015 Couchbase Inc. 3
The Plan
Where are things headed The business problem Couchbase Mobile Example native code Example hybrid code
©2015 Couchbase Inc. 10
How Does This Affect What People Think?
Doesn’t work a lot of the time and when it does it’s slow.
©2015 Couchbase Inc. 11
How Does This Affect App Uninstall Rates?
0%
20%
40%
60%
80%
100%
FreezingCrashingSlow Responsiveness
Unin
stal
l Rat
e
Source: uSamp
©2015 Couchbase Inc. 14
What Does This Mean For Your Apps
Always work both online & offlineAlways be blazing fast
Built with orders of magnitude less codeUsers will absolutely love your apps
©2015 Couchbase Inc. 17
Couchbase Lite
• NoSQL Mobile Database• Document Oriented & Schema-Less• Small Footprint• Runs In-Process
©2015 Couchbase Inc. 18
Couchbase Sync Gateway
• Data Replication Between Server & Device
• Data Orchestration• Authentication & Authorization
©2015 Couchbase Inc. 19
Replication
Is asynchronous Can be continuous or one-shot Sends JSON over HTTP Handles network hiccups Network timeouts
©2015 Couchbase Inc. 23
Couchbase Mobile Summary
Offline first approach NoSQL document database Works with Couchbase Server Available for many platforms and frameworks
©2015 Couchbase Inc. 28
Map / Reduce Views
Concept from functional program, via Google App-defined map function operates on
documents Function output generates an index ordered by
key Index rows can be aggregated via a reduce
function Index is queried by a key or key range
©2015 Couchbase Inc. 31
Other Ways To Listen
DatabaseChanged: Any document updated DocumentChanged: A specific document
updated LiveQuery: Change in query result set
©2015 Couchbase Inc. 32
Couchbase Lite for iOS Special Note
iOS SDK works for OS X desktop applications
©2015 Couchbase Inc. 34
Couchbase Cordova Plugin
Compatible with Android and iOS Access Couchbase Lite via RESTful APIs Easily integrate with Ionic Framework and
PhoneGap through the ng-couchbase-lite wrapper
©2015 Couchbase Inc. 45
Code Walkthrough! Creating the UI Initializing the Android ListView Designing the Android ListView Creating a database and replicating with the
server Listening for database changes Adding data to the database Removing data from the database Cleaning up when terminating the application
©2015 Couchbase Inc. 47
Couchbase Labs on GitHub
https://github.com/couchbaselabs/todolite-androidhttps://github.com/couchbaselabs/todolite-ioshttps://github.com/couchbaselabs/todolite-ionic