SlideShare a Scribd company logo
YOUR APP. OUR CLOUD.
THE PROBLEM
2
Vast amounts of time and money is
spent
building a backend infrastructure
The mobile developers business
is mobile development
1 Have an idea
2 Define a backend
infrastructure
Pick a hosting provider
3 Develop your backend
software
Test the infrastructure
4 Build your mobile application
5 Maintain your infrastructure
WHAT IS CLOUDBASE.IO
3
cloudbase.io is the entire
backend stack of your
mobile application
Leaving you free to do
what you do best…
Build mobile applications
 CloudBase
Online data storage
 CloudFunctions
Your code, our hardware
 Push Notifications
One call – push to all
 Analytics
Improve by understanding your
users
 Multi Platform
All of the mobile platforms in one
place
A PRACTICAL EXAMPLE
4
$39.99
Per month
A small virtual server to
begin
$12,000 2 web developers building
your backend in 3 weeks
$2,000 Adjustments to your backend
$150
Per month
A more powerful production
server
$5,000
Per month
Hire a system administrator
$ ∞ Scale your infrastructure
FREE Sign up with cloudbase.io
$ ? Build your application
$11.99
Per month
Start with a cloudbase.io
basic account
JavaScript - a bit of history
5
1995 Used to be a dirty word
2005 jQuery changed the
game
2011 HTML5/CSS3 go mainstream, responsive web design is
here
2013 10 of the top 20 most popular projects on GitHub are JS
JavaScript goes mobile
6
Modern smartphones include HTML5
and CSS3 compatible browsers
A number of popular web development
framework go mobile and building UI
becomes incredibly simple
We have UI covered – what’s missing?
What’s missing?
7
• Access to the native
APIs
• A real backend
Let’s build an application
8
What we want to try and build is a clone of FourSquare.
It will require:
• Access to the native API for location
• A database to store its data
• Push notifications to share it
The Cloud Database
9
The cloudbase.io Cloud Database is an in-memory object-
oriented NoSql database.
• Store and retrieve complex objects
• Searchable like an SQL database
• Advanced geo-location search
• Files, such as images, can be attached to all documents
SQL Cloud Database
Table Collection
Row Document
The JavaScript helper class
10
• The JavaScript helper class does not depend on any framework
• A number of includes make the various components available
• XMLHttpRequest
• Md5
• Platform specific helper
• CBHelper – the main helper class object
• Data is received through callback methods in the form of a
CBHelperResponseInfo object
• Location data can be sent with each request in the form of a
CBHelperCurrentLocation object
• Files can be attached to cloud database documents and downloaded
as Blob data
User interaction flow
11
1 A user registers or logs in with an existing account
2 The user is presented with a map of other users’ current location
3
The user decides to “check-in” at a location – The current
location is converted to an address and saved in the cloud
4 Nearby users are sent a push notification with the updated location
1 - Login
12
1. Declare and initialize
the cloudbase.io
helper class
2. Do we know the user?
3. Login
var helper;
$(function() {
helper = new CBHelper('app-code', 'app-unique');
helper.setPassword(hex_md5('my-app-password'));
if ( localStorage && localStorage.CloudSquareUser ) {
// we know the user. Load the data and set
// it in the helper class
} else {
// load the login/registration form
}
});
var loginCondition = {
"username" : username.toLowerCase(),
"password" : password
};
helper.searchDocuments(loginCondition, "users", function(resp) {
if ( resp.outputData.length > 0 ) {
document.location.href = 'home.html';
}
});
1.1 - Registration
13
1. Is the username
taken?
1. Create the user
1. Redirect to the main
page
helper.searchDocuments(
{ "username" : username.toLowerCase() },
"users", function(resp) {
if ( resp.callStatus && resp.outputData.length == 0 ) {
var user = {
"username" : username.toLowerCase(),
"password" : hex_md5(password)
};
helper.insertDocument("users", user, null, function(resp) {
if ( resp.callStatus &&
resp.outputData == "Inserted") {
document.location.href = 'home.html';
}
});
}
});
2 - Find other users
14
1. Get the current
position
1. Find users nearby
5KMs in radians
1. Add the user as a pin
on the map
var currentPosition = null;
navigator.geolocation.getCurrentPosition(
function (position) {
currentPosition = new CBHelperCurrentLocation(
position.coords.latitude,
position.coords.longitude,
position.coords.altitude);
});
var search = {
'cb_location' : {
'$near' : [ currentPosition.lat, currentPosition.lng ],
'$maxDistance' : (5000/1000)/111.12
}
};
helper.searchDocuments(search, "latest_position", function(resp) {
if ( resp.callStatus ) {
for ( index in resp.outputData ) {
var user = resp.outputData[index];
var userPos = new google.maps.LatLng(
user.cb_location.lat, user.cb_location.lng);
}
}
});
3 - Checkin
15
1. Get the address from
the position using a
cloudbase.io applet
2. Read the current
address
1. Create the new
checkin object and add
it to the history
1. The helper class will
send the current
position automatically
so long as the
currentLocation
property is set
helper.executeApplet("cb_get_address_from_coordinates",
{ "lat" : currentPosition.lat,
"lng" : currentPosition.lng }, function(resp) {
var address = resp.outputData["return"].formatted_address;
var newCheckin = {
"user" : user,
"address" : address,
"time" : new Date().getTime()
}
helper.insertDocument(
"checkins", newCheckin, null, function(resp) {
});
});
3.1 – Checkin, latest position
16
1. Check if we already
have a record of the
user’s position
2. If we already have a
latest position update
the existing record
1. Insert a new record for
the user
helper.searchDocuments(
{ "user" : user },
"latest_position",
function(searchResp) {
if ( searchResp.outputData.length > 0 ) {
helper.updateDocument(
newCheckin, { "user" : user }, "latest_position", null,
function(updateResp) {
mosync.rlog(updateResp.outputString);
});
} else {
helper.insertDocument(
"latest_position",
newCheckin, null,
function(insertResp) {
mosync.rload(insertResp.outputString);
});
}
});
4 – Push notifications
17
1. When the application
starts the device
registers for push
notifications
2. Once we have the
address of the current
location create a
channel for the city
1. Notify all other users in
the same city
var pushManager = new PushNotificationManager();
pushManager.register(function(token) {
// subscribe the current device to the push notification channel
pushToken = token;
},
function(error) {
mosync.rlog("Error " + JSON.stringify(error));
});
if ( curComponent.types && curComponent.types.length > 0 &&
curComponent.types[0] == "administrative_area_level_2" ) {
city = curComponent.short_name;
helper.registerDeviceForNotifications(
pushToken, city,
function(registrationOutcome) {
mosync.rlog(”Registered”);
});
}
if ( city != "" && pushToken ) {
// the last parameter is the iOS certificate type
helper.sendNotification("I'm in " + city, city, "development");
}
4.1 – Automated push notifications
18
An alternative to the method described in slide 4 is to send
push notifications through a Cloud Function attached to the
latest_position collection as a trigger
What next?
19
• Social aspect
• Login with facebook – Social Media Applets cb_facebook_get_profile
• Adding friends to make social groups – Cloud Database
• Comments on checkins – Cloud Database / Push Notifications
• Send direct messages – Cloud Database / Push Notifications
• Invite friends – Cloud Database / Push Notifications
• Media
• Attach photos to checkins – Cloud database
• Additional information
• Create venues instead of address – Cloud Functions / Cloud Database
• Full profile – Cloud Database

More Related Content

PPTX
Html indexed db
PDF
Diving into php
PDF
Getting Started with MongoDB: 4 Application Designs
PPTX
What's Parse
PPTX
Google cloud datastore driver for Google Apps Script DB abstraction
PDF
Eventsourcing with PHP and MongoDB
PDF
Server Side Events
PDF
第一次用Parse就深入淺出
Html indexed db
Diving into php
Getting Started with MongoDB: 4 Application Designs
What's Parse
Google cloud datastore driver for Google Apps Script DB abstraction
Eventsourcing with PHP and MongoDB
Server Side Events
第一次用Parse就深入淺出

What's hot (20)

PDF
Sebastian Schmidt, Rachel Myers - How To Go Serverless And Not Violate The GD...
PPTX
Intro to Parse
PDF
Node.js and Parse
PPTX
Data sync on iOS with Couchbase Mobile
PPTX
Dbabstraction
PDF
Building Android apps with Parse
PPT
OmniBase Object Database
PDF
OpenStack Log Mining
PDF
Streaming using Kafka Flink & Elasticsearch
PDF
MPD2011 | Сергей Клюев "RESTfull iOS with RestKit"
PDF
MongoDB .local Toronto 2019: Using Change Streams to Keep Up with Your Data
PPTX
Google apps script database abstraction exposed version
KEY
RESTfull with RestKit
PPTX
Implementing a Fileserver with Nginx and Lua
PDF
Tools and Projects Dec 2018 Edition
PDF
JavaScript APIs - The Web is the Platform - .toster conference, Moscow
PPTX
Android writing and reading from firebase
PDF
Modern Android app library stack
PPTX
Building .NET Apps using Couchbase Lite
DOCX
Caching in asp.net
Sebastian Schmidt, Rachel Myers - How To Go Serverless And Not Violate The GD...
Intro to Parse
Node.js and Parse
Data sync on iOS with Couchbase Mobile
Dbabstraction
Building Android apps with Parse
OmniBase Object Database
OpenStack Log Mining
Streaming using Kafka Flink & Elasticsearch
MPD2011 | Сергей Клюев "RESTfull iOS with RestKit"
MongoDB .local Toronto 2019: Using Change Streams to Keep Up with Your Data
Google apps script database abstraction exposed version
RESTfull with RestKit
Implementing a Fileserver with Nginx and Lua
Tools and Projects Dec 2018 Edition
JavaScript APIs - The Web is the Platform - .toster conference, Moscow
Android writing and reading from firebase
Modern Android app library stack
Building .NET Apps using Couchbase Lite
Caching in asp.net
Ad

Similar to Cloudbase.io MoSync Reload Course (20)

POTX
1140 p2 p04_and_1350_p2p05_and_1440_p2p06
PPTX
Codestrong 2012 breakout session the role of cloud services in your next ge...
PDF
How Location and Context Changes Everything for Mobile Apps
PDF
iOSDevCamp Firebase Overview
POTX
Mobile 1: Mobile Apps with MongoDB
PPTX
Discover Google Firebase Platform
PPTX
Couchbase Mobile Ideathon in Tokyo 2014.08.29: Developing with couchbase lite
PPTX
My cloud + Windows Phone app experience
PPTX
PDF
Couchbase Mobile on Android
PPTX
Introducing cloud technology & mobile apps development
PPTX
Google Firebase
PPTX
google platform.pptx
PDF
iPhone offline webapps
PDF
Mobile app class Chicago
PDF
Bluemix Mobile Cloud Services - Accelerating Mobile App Development
KEY
20120306 dublin js
PPTX
How to build a SaaS solution in 60 days
PPTX
Powering Systems of Engagement
PDF
Up and Running with firebase
1140 p2 p04_and_1350_p2p05_and_1440_p2p06
Codestrong 2012 breakout session the role of cloud services in your next ge...
How Location and Context Changes Everything for Mobile Apps
iOSDevCamp Firebase Overview
Mobile 1: Mobile Apps with MongoDB
Discover Google Firebase Platform
Couchbase Mobile Ideathon in Tokyo 2014.08.29: Developing with couchbase lite
My cloud + Windows Phone app experience
Couchbase Mobile on Android
Introducing cloud technology & mobile apps development
Google Firebase
google platform.pptx
iPhone offline webapps
Mobile app class Chicago
Bluemix Mobile Cloud Services - Accelerating Mobile App Development
20120306 dublin js
How to build a SaaS solution in 60 days
Powering Systems of Engagement
Up and Running with firebase
Ad

Recently uploaded (20)

PDF
Shreyas Phanse Resume: Experienced Backend Engineer | Java • Spring Boot • Ka...
PPTX
VMware vSphere Foundation How to Sell Presentation-Ver1.4-2-14-2024.pptx
PDF
Dropbox Q2 2025 Financial Results & Investor Presentation
PDF
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
PDF
Building Integrated photovoltaic BIPV_UPV.pdf
PDF
Diabetes mellitus diagnosis method based random forest with bat algorithm
PDF
NewMind AI Weekly Chronicles - August'25 Week I
PDF
Network Security Unit 5.pdf for BCA BBA.
PDF
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
PDF
Chapter 3 Spatial Domain Image Processing.pdf
PDF
Approach and Philosophy of On baking technology
PDF
cuic standard and advanced reporting.pdf
PPTX
PA Analog/Digital System: The Backbone of Modern Surveillance and Communication
PDF
NewMind AI Monthly Chronicles - July 2025
PDF
KodekX | Application Modernization Development
PDF
Per capita expenditure prediction using model stacking based on satellite ima...
PDF
Agricultural_Statistics_at_a_Glance_2022_0.pdf
PPT
“AI and Expert System Decision Support & Business Intelligence Systems”
PDF
Peak of Data & AI Encore- AI for Metadata and Smarter Workflows
DOCX
The AUB Centre for AI in Media Proposal.docx
Shreyas Phanse Resume: Experienced Backend Engineer | Java • Spring Boot • Ka...
VMware vSphere Foundation How to Sell Presentation-Ver1.4-2-14-2024.pptx
Dropbox Q2 2025 Financial Results & Investor Presentation
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
Building Integrated photovoltaic BIPV_UPV.pdf
Diabetes mellitus diagnosis method based random forest with bat algorithm
NewMind AI Weekly Chronicles - August'25 Week I
Network Security Unit 5.pdf for BCA BBA.
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
Chapter 3 Spatial Domain Image Processing.pdf
Approach and Philosophy of On baking technology
cuic standard and advanced reporting.pdf
PA Analog/Digital System: The Backbone of Modern Surveillance and Communication
NewMind AI Monthly Chronicles - July 2025
KodekX | Application Modernization Development
Per capita expenditure prediction using model stacking based on satellite ima...
Agricultural_Statistics_at_a_Glance_2022_0.pdf
“AI and Expert System Decision Support & Business Intelligence Systems”
Peak of Data & AI Encore- AI for Metadata and Smarter Workflows
The AUB Centre for AI in Media Proposal.docx

Cloudbase.io MoSync Reload Course

  • 1. YOUR APP. OUR CLOUD.
  • 2. THE PROBLEM 2 Vast amounts of time and money is spent building a backend infrastructure The mobile developers business is mobile development 1 Have an idea 2 Define a backend infrastructure Pick a hosting provider 3 Develop your backend software Test the infrastructure 4 Build your mobile application 5 Maintain your infrastructure
  • 3. WHAT IS CLOUDBASE.IO 3 cloudbase.io is the entire backend stack of your mobile application Leaving you free to do what you do best… Build mobile applications  CloudBase Online data storage  CloudFunctions Your code, our hardware  Push Notifications One call – push to all  Analytics Improve by understanding your users  Multi Platform All of the mobile platforms in one place
  • 4. A PRACTICAL EXAMPLE 4 $39.99 Per month A small virtual server to begin $12,000 2 web developers building your backend in 3 weeks $2,000 Adjustments to your backend $150 Per month A more powerful production server $5,000 Per month Hire a system administrator $ ∞ Scale your infrastructure FREE Sign up with cloudbase.io $ ? Build your application $11.99 Per month Start with a cloudbase.io basic account
  • 5. JavaScript - a bit of history 5 1995 Used to be a dirty word 2005 jQuery changed the game 2011 HTML5/CSS3 go mainstream, responsive web design is here 2013 10 of the top 20 most popular projects on GitHub are JS
  • 6. JavaScript goes mobile 6 Modern smartphones include HTML5 and CSS3 compatible browsers A number of popular web development framework go mobile and building UI becomes incredibly simple We have UI covered – what’s missing?
  • 7. What’s missing? 7 • Access to the native APIs • A real backend
  • 8. Let’s build an application 8 What we want to try and build is a clone of FourSquare. It will require: • Access to the native API for location • A database to store its data • Push notifications to share it
  • 9. The Cloud Database 9 The cloudbase.io Cloud Database is an in-memory object- oriented NoSql database. • Store and retrieve complex objects • Searchable like an SQL database • Advanced geo-location search • Files, such as images, can be attached to all documents SQL Cloud Database Table Collection Row Document
  • 10. The JavaScript helper class 10 • The JavaScript helper class does not depend on any framework • A number of includes make the various components available • XMLHttpRequest • Md5 • Platform specific helper • CBHelper – the main helper class object • Data is received through callback methods in the form of a CBHelperResponseInfo object • Location data can be sent with each request in the form of a CBHelperCurrentLocation object • Files can be attached to cloud database documents and downloaded as Blob data
  • 11. User interaction flow 11 1 A user registers or logs in with an existing account 2 The user is presented with a map of other users’ current location 3 The user decides to “check-in” at a location – The current location is converted to an address and saved in the cloud 4 Nearby users are sent a push notification with the updated location
  • 12. 1 - Login 12 1. Declare and initialize the cloudbase.io helper class 2. Do we know the user? 3. Login var helper; $(function() { helper = new CBHelper('app-code', 'app-unique'); helper.setPassword(hex_md5('my-app-password')); if ( localStorage && localStorage.CloudSquareUser ) { // we know the user. Load the data and set // it in the helper class } else { // load the login/registration form } }); var loginCondition = { "username" : username.toLowerCase(), "password" : password }; helper.searchDocuments(loginCondition, "users", function(resp) { if ( resp.outputData.length > 0 ) { document.location.href = 'home.html'; } });
  • 13. 1.1 - Registration 13 1. Is the username taken? 1. Create the user 1. Redirect to the main page helper.searchDocuments( { "username" : username.toLowerCase() }, "users", function(resp) { if ( resp.callStatus && resp.outputData.length == 0 ) { var user = { "username" : username.toLowerCase(), "password" : hex_md5(password) }; helper.insertDocument("users", user, null, function(resp) { if ( resp.callStatus && resp.outputData == "Inserted") { document.location.href = 'home.html'; } }); } });
  • 14. 2 - Find other users 14 1. Get the current position 1. Find users nearby 5KMs in radians 1. Add the user as a pin on the map var currentPosition = null; navigator.geolocation.getCurrentPosition( function (position) { currentPosition = new CBHelperCurrentLocation( position.coords.latitude, position.coords.longitude, position.coords.altitude); }); var search = { 'cb_location' : { '$near' : [ currentPosition.lat, currentPosition.lng ], '$maxDistance' : (5000/1000)/111.12 } }; helper.searchDocuments(search, "latest_position", function(resp) { if ( resp.callStatus ) { for ( index in resp.outputData ) { var user = resp.outputData[index]; var userPos = new google.maps.LatLng( user.cb_location.lat, user.cb_location.lng); } } });
  • 15. 3 - Checkin 15 1. Get the address from the position using a cloudbase.io applet 2. Read the current address 1. Create the new checkin object and add it to the history 1. The helper class will send the current position automatically so long as the currentLocation property is set helper.executeApplet("cb_get_address_from_coordinates", { "lat" : currentPosition.lat, "lng" : currentPosition.lng }, function(resp) { var address = resp.outputData["return"].formatted_address; var newCheckin = { "user" : user, "address" : address, "time" : new Date().getTime() } helper.insertDocument( "checkins", newCheckin, null, function(resp) { }); });
  • 16. 3.1 – Checkin, latest position 16 1. Check if we already have a record of the user’s position 2. If we already have a latest position update the existing record 1. Insert a new record for the user helper.searchDocuments( { "user" : user }, "latest_position", function(searchResp) { if ( searchResp.outputData.length > 0 ) { helper.updateDocument( newCheckin, { "user" : user }, "latest_position", null, function(updateResp) { mosync.rlog(updateResp.outputString); }); } else { helper.insertDocument( "latest_position", newCheckin, null, function(insertResp) { mosync.rload(insertResp.outputString); }); } });
  • 17. 4 – Push notifications 17 1. When the application starts the device registers for push notifications 2. Once we have the address of the current location create a channel for the city 1. Notify all other users in the same city var pushManager = new PushNotificationManager(); pushManager.register(function(token) { // subscribe the current device to the push notification channel pushToken = token; }, function(error) { mosync.rlog("Error " + JSON.stringify(error)); }); if ( curComponent.types && curComponent.types.length > 0 && curComponent.types[0] == "administrative_area_level_2" ) { city = curComponent.short_name; helper.registerDeviceForNotifications( pushToken, city, function(registrationOutcome) { mosync.rlog(”Registered”); }); } if ( city != "" && pushToken ) { // the last parameter is the iOS certificate type helper.sendNotification("I'm in " + city, city, "development"); }
  • 18. 4.1 – Automated push notifications 18 An alternative to the method described in slide 4 is to send push notifications through a Cloud Function attached to the latest_position collection as a trigger
  • 19. What next? 19 • Social aspect • Login with facebook – Social Media Applets cb_facebook_get_profile • Adding friends to make social groups – Cloud Database • Comments on checkins – Cloud Database / Push Notifications • Send direct messages – Cloud Database / Push Notifications • Invite friends – Cloud Database / Push Notifications • Media • Attach photos to checkins – Cloud database • Additional information • Create venues instead of address – Cloud Functions / Cloud Database • Full profile – Cloud Database