SlideShare a Scribd company logo
Building Cross-Platform
Mobile Apps
Mobile Dev+Test
14 April 2015 - San Diego CA
Troy Miles
Over 35 years of programming experience
Blog: http://therockncoder.blogspot.com/
Twitter: @therockncoder
Email: rockncoder@gmail.com
GitHub: https://github.com/Rockncoder
Agenda
A Quick & Dirty JavaScript Overview
What is PhoneGap?
Building PhoneGap Apps
Debugging
Plugins
Agenda
Backbone
Underscore
Models
Collections
Views
The Router
Agenda
Templates
Chocolate Chip
Lists
Look and Feel
Summary
The End of HTML5 as a
Platform?
Facebook mobile apps on iOS and Android were
originally using HTML5
Users complained about speed and style
In 2012, Facebook switch to native apps
The pundits announced the end of HTML5 as a mobile
platform and the end of PhoneGap too
JavaScript Best Practices
Avoid sloppy JavaScript
Avoid the Global Space
Encapsulate Code into Objects
Use Design Patterns
Avoid Sloppy JavaScript
Use “strict” mode
Always use ‘===’ & ‘!==’
Code in JavaScript not C#, Java, Ruby, etc.
Use JSLint or JSHint
Avoid the Global Space
Minimize use of global variables
Use Name-spacing
Use anonymous/immediate functions when appropriate
Functions
Functions are a first class type
Like other types they can be passed and assigned
freely
Anonymous functions are used frequently
Objects
Objects are some what like Key/Value dictionaries in
other languages
The Key can be anything when wrapped in quotes
The Value can be any type including a function
Events
Events allow for excellent separation of concerns
You can listen for system events or
Trigger and respond to your own
Many external libraries will communicate via events
Promises
A rather new JavaScript concept
Used to handle asynchronous callbacks
The app uses jQuery’s version
PhoneGap/Cordova History
2009: 1st developed at an
iPhoneDevCamp event
2009: Developers form a
company, Nitobi
2011: Adobe acquires Nitobi
2011: Adobe open sources
PhoneGap project to Apache
2012: Apache gives the
project the name Cordova
Cordova Forks
Adobe PhoneGap
IBM Worklight
Telerik Platform
Intel XDK
BlackBerry WebWorks
The Ionic Framework
Target Platforms
Amazon FireOS
Google Android
BlackBerry 10
Firefox OS
Apple iOS
Ubuntu Linux
Microsoft Windows Phone 8
Development Platforms
OS X
All except Windows Phone / Windows
Windows
All except iOS
Linux
All except Windows Phone and iOS
PhoneGap
Current release is 4.2
Node.js is a hard requirement since version 3.0
It is all command line instead of IDE
Recommend not upgrading your app to a new version
right away
How PhoneGap works?
Most device APIs include an internal web browser
PhoneGap uses this internal web browser as its app
canvas
It adds more features to the navigator via software
which bridges the gap between the internal web and
the device
The Hard Things
Installation
Knowing the difference between PhoneGap & Cordova
Deciding what to do past hello, world
Node Package Manager
npm is very popular in the open source community
cross-platform
coding standard
storage site + discovery mechanism
delivery mechanism
used by phonegap/cordova
Let’s build an app, part 1a
Hello, world
cordova create hello com.rnc.hello Hello
cd hello
cordova platform add browser --usegit
cordova run browser
hooks
Allows you to execute code at defined points in the
Cordova application build process
Example minify your JavaScript
platforms
One directory for each device framework you support
Because of the complexity involved in getting individual
machines setup, we will demonstrate this but not
actually work through it as an excercise
plugins
Modular pieces of native code which give your app increased
functionality
Familiar Plugins
console
device
dialogs
inappbrowser
www
Your app's root directory
laid out as a set of sub-directories
css
img
js
index.html
config.xml
Defines a widget
Must be in root directory
Actually defined by the W3C
http://www.w3.org/TR/widgets/#configuration-
document-0
Let’s build an app, part 1b
Adding a plugin
Two important pieces of information
how to install a plugin
how to make it work
http://plugins.cordova.io/#/package/
org.apache.cordova.camera
cordova plugin add org.apache.cordova.camera
navigator.camera.getPicture(onSuccess, onFail, { quality: 50,
destinationType: Camera.DestinationType.DATA_URL});
function onSuccess(imageData) {
var image = document.getElementById('myImage');
image.src = "data:image/jpeg;base64," + imageData;}
function onFail(message) {
alert('Failed because: ' + message);}
Debugging
Using the browser while developing
Chrome remote for Android devices
Safari remote for iOS devices
Windows Phone winre
UI Options
Roll Your Own
jQuery / jQuery UI
jQuery Mobile
Bootstrap
Chocolate Chip UI
Framework Options
Roll Your Own
AngularJS
Knockout
BackboneJS
Underscore
A utility belt library for JavaScript
Excellent at manipulating objects and collections
About 6kb minified and compressed
Required for Backbone apps
Backbone
A MV* Framework
Note: There are no controllers hence no ‘C’
More lightweight than Angular, Ember, or Knockout
Requires jQuery and Underscore
Models
The base object in Backbone
Essentially a wrapper around a JavaScript object
Use get and set command to access properties
Collections
A collection of models
Can associate a URL with a collection
Backbone native support of RESTful API
Can also use third party API
Views
Backbone’s UI layer
Also does much of what a controller would do in typical
MVC
The Router
The router controls application state
In a web site it would control what is in the URL bar
PhoneGap apps may lack a visible URL bar, but it still
exists
Templates
Templates render markup to the DOM in a cookie
cutter fashion
Especially good for render collections to a view
Make it easier to create single page apps
Chocolate Chip UI
A UI Framework akin to jQuery Mobile or even
Bootstrap
Does a great job of impersonating iOS, Android, and
Windows Phone 8
Lists
You will work a lot with lists in mobile apps
In CC, lists will have the look and feel of the device
Lists typically will need a bit of code to make them fully
functional
Lists
Lists have classes which enhance their looks
Classes exists to indicate:
Navigation to another page
Navigation to a details page
Widgets
CC uses a combo of its own stuff with HTML5
For example the Range Slider is simply an HTML5
input type=range
But a switch is a combination of HTML, CSS3, and
JavaScript
Look & Feel
Switching the look and feel is easy, just change CSS
files
PhoneGap version 3+ automates the process
Look & Feel
iOS: chui-ios-3.8.4.min.css
Android 4+: chui-android-3.8.4.min.css
Windows Phone 8: chui-win-3.8.4.min.css
Look & Feel
PhoneGap’s merges folder
one directory for each supported device
Its contents will be copied and overwrite during the
build command
Name all of the css files identically
Place in each appropriate folder
Let’s build an app, part 2
pg-twitter
cordova create pg-twitter com.rnc.pgtwitter pg-twitter
cd pg-twitter
cordova platform add browser --usegit
cordova run browser
merges directory
Must be created by hand
named after support platforms
contents of the merge directory will be written to the
www during build
files/directories with the same name will be overwritten
Two Things Really Quick
PhoneGap Build
PhoneGap Developer App
Resources
http://phonegap.com/
http://cordova.apache.org/docs/en/4.0.0/index.html
http://cordova.apache.org/
http://backbonejs.org/
http://underscorejs.org/
Resources
http://momentjs.com/
http://plugins.cordova.io/#/
http://jquery.com/
http://chocolatechip-ui.com/index.html
http://www.raymondcamden.com/
The Rockncoder
http://therockncoder.blogspot.com
http://www.youtube.com/user/rockncoder
https://github.com/Rockncoder/pg-twitter
http://www.slideshare.net/rockncoder
Summary
Speed of development
Ease of development
Cross-platform by design
Please rate this talk!
http://spkr8.com/t/44241

More Related Content

PDF
Building data driven mobile apps with phone gap and webapi
PDF
Building Desktop RIAs with PHP, HTML & Javascript in AIR
PDF
Cross Platform Mobile Development
PDF
Cordova and PhoneGap Insights
PDF
Creating mobile apps - an introduction to Ionic (Engage 2016)
PPTX
Ionic framework
PPT
Cache me if you can
PDF
Ionic framework one day training
Building data driven mobile apps with phone gap and webapi
Building Desktop RIAs with PHP, HTML & Javascript in AIR
Cross Platform Mobile Development
Cordova and PhoneGap Insights
Creating mobile apps - an introduction to Ionic (Engage 2016)
Ionic framework
Cache me if you can
Ionic framework one day training

What's hot (20)

PPTX
PPTX
Activate bots within SharePoint Framework
PDF
JWC 2015 - Mobile apps development for Joomla!
PDF
Cordova + Ionic + MobileFirst
PPTX
Universal Windows Platform
PDF
PhoneGap: Building Mobile Applications with HTML/JS
PPT
Mobile app development using PhoneGap - A comprehensive walkthrough - Touch T...
PPTX
SharePoint Framework -The future of SharePoint/ Office 365 developer ecosystem.
PPTX
Workshop on Hybrid App Development with Ionic Framework
PPTX
Developing Hybrid Applications with IONIC
PPTX
Developing Enterprise-Grade Mobile Applications
PDF
Mobile applications development - why should you start learning it right now?
PPTX
Publishing API documentation -- Workshop
PPTX
Publishing API documentation -- Presentation
PPTX
Documenting REST APIs
PPTX
JavaScript for ASP.NET programmers (webcast) upload
PPT
Top java script frameworks ppt
ODP
REST API for Joomla
PPTX
Application innovation & Developer Productivity
PDF
Developing ionic apps for android and ios
Activate bots within SharePoint Framework
JWC 2015 - Mobile apps development for Joomla!
Cordova + Ionic + MobileFirst
Universal Windows Platform
PhoneGap: Building Mobile Applications with HTML/JS
Mobile app development using PhoneGap - A comprehensive walkthrough - Touch T...
SharePoint Framework -The future of SharePoint/ Office 365 developer ecosystem.
Workshop on Hybrid App Development with Ionic Framework
Developing Hybrid Applications with IONIC
Developing Enterprise-Grade Mobile Applications
Mobile applications development - why should you start learning it right now?
Publishing API documentation -- Workshop
Publishing API documentation -- Presentation
Documenting REST APIs
JavaScript for ASP.NET programmers (webcast) upload
Top java script frameworks ppt
REST API for Joomla
Application innovation & Developer Productivity
Developing ionic apps for android and ios
Ad

Similar to Building Cross-Platform Mobile Apps (20)

PDF
Building mobile apps with PhoneGap and Backbone
PDF
[2015/2016] Apache Cordova
PPTX
phonegap_101
PDF
Apache Cordova 4.x
PDF
Apache Cordova
KEY
Future of Mobile
PDF
Building Mobile Cross-Platform Apps with HTML5, jQuery Mobile & PhoneGap
PDF
PhoneGap/Cordova
PDF
Cordova: APIs and instruments
PDF
PhoneGap in 60 Minutes or Less
PDF
Mobile Development with PhoneGap
PDF
Introduction to Phonegap
KEY
Intro to PhoneGap
PDF
Developing Great Apps with Apache Cordova
PPTX
PhoneGap - Now and the Future
PPT
Apache Cordova phonegap plugins for mobile app development
PPTX
Mobile Development with PhoneGap
KEY
HTML5 is the Future of Mobile, PhoneGap Takes You There Today
PPT
Phonegap android
PPTX
Hybrid Mobile Development with Apache Cordova and
Building mobile apps with PhoneGap and Backbone
[2015/2016] Apache Cordova
phonegap_101
Apache Cordova 4.x
Apache Cordova
Future of Mobile
Building Mobile Cross-Platform Apps with HTML5, jQuery Mobile & PhoneGap
PhoneGap/Cordova
Cordova: APIs and instruments
PhoneGap in 60 Minutes or Less
Mobile Development with PhoneGap
Introduction to Phonegap
Intro to PhoneGap
Developing Great Apps with Apache Cordova
PhoneGap - Now and the Future
Apache Cordova phonegap plugins for mobile app development
Mobile Development with PhoneGap
HTML5 is the Future of Mobile, PhoneGap Takes You There Today
Phonegap android
Hybrid Mobile Development with Apache Cordova and
Ad

More from Troy Miles (20)

PDF
Fast C++ Web Servers
PDF
Node Boot Camp
PDF
AWS Lambda Function with Kotlin
PDF
React Native One Day
PDF
React Native Evening
PDF
Intro to React
PDF
React Development with the MERN Stack
PDF
Angular Application Testing
PDF
ReactJS.NET
PDF
What is Angular version 4?
PDF
Angular Weekend
PDF
From MEAN to the MERN Stack
PDF
Functional Programming in JavaScript
PDF
Functional Programming in Clojure
PDF
MEAN Stack Warm-up
PDF
The JavaScript You Wished You Knew
PDF
Game Design and Development Workshop Day 1
PDF
Build a Game in 60 minutes
PDF
Quick & Dirty & MEAN
PDF
A Quick Intro to ReactiveX
Fast C++ Web Servers
Node Boot Camp
AWS Lambda Function with Kotlin
React Native One Day
React Native Evening
Intro to React
React Development with the MERN Stack
Angular Application Testing
ReactJS.NET
What is Angular version 4?
Angular Weekend
From MEAN to the MERN Stack
Functional Programming in JavaScript
Functional Programming in Clojure
MEAN Stack Warm-up
The JavaScript You Wished You Knew
Game Design and Development Workshop Day 1
Build a Game in 60 minutes
Quick & Dirty & MEAN
A Quick Intro to ReactiveX

Recently uploaded (20)

PDF
Design an Analysis of Algorithms II-SECS-1021-03
PDF
top salesforce developer skills in 2025.pdf
PDF
Raksha Bandhan Grocery Pricing Trends in India 2025.pdf
PDF
Claude Code: Everyone is a 10x Developer - A Comprehensive AI-Powered CLI Tool
PDF
Understanding Forklifts - TECH EHS Solution
PDF
Design an Analysis of Algorithms I-SECS-1021-03
PPTX
L1 - Introduction to python Backend.pptx
PDF
Why TechBuilder is the Future of Pickup and Delivery App Development (1).pdf
PDF
Upgrade and Innovation Strategies for SAP ERP Customers
PDF
Flood Susceptibility Mapping Using Image-Based 2D-CNN Deep Learnin. Overview ...
PDF
Wondershare Filmora 15 Crack With Activation Key [2025
PDF
Digital Strategies for Manufacturing Companies
PDF
AI in Product Development-omnex systems
PDF
Navsoft: AI-Powered Business Solutions & Custom Software Development
PDF
How to Migrate SBCGlobal Email to Yahoo Easily
PPTX
ai tools demonstartion for schools and inter college
PPT
Introduction Database Management System for Course Database
PPTX
Online Work Permit System for Fast Permit Processing
PPTX
Lecture 3: Operating Systems Introduction to Computer Hardware Systems
PDF
System and Network Administration Chapter 2
Design an Analysis of Algorithms II-SECS-1021-03
top salesforce developer skills in 2025.pdf
Raksha Bandhan Grocery Pricing Trends in India 2025.pdf
Claude Code: Everyone is a 10x Developer - A Comprehensive AI-Powered CLI Tool
Understanding Forklifts - TECH EHS Solution
Design an Analysis of Algorithms I-SECS-1021-03
L1 - Introduction to python Backend.pptx
Why TechBuilder is the Future of Pickup and Delivery App Development (1).pdf
Upgrade and Innovation Strategies for SAP ERP Customers
Flood Susceptibility Mapping Using Image-Based 2D-CNN Deep Learnin. Overview ...
Wondershare Filmora 15 Crack With Activation Key [2025
Digital Strategies for Manufacturing Companies
AI in Product Development-omnex systems
Navsoft: AI-Powered Business Solutions & Custom Software Development
How to Migrate SBCGlobal Email to Yahoo Easily
ai tools demonstartion for schools and inter college
Introduction Database Management System for Course Database
Online Work Permit System for Fast Permit Processing
Lecture 3: Operating Systems Introduction to Computer Hardware Systems
System and Network Administration Chapter 2

Building Cross-Platform Mobile Apps