SlideShare a Scribd company logo
Intro to PhoneGap 
Ramesh Nair / hiddentao 
Oct 2014 @ Taipei Javascript Enthusiasts
What is PhoneGap? 
• Build mobile apps using HTML5, Javascript and CSS 
• Created by Nitobi in 2008 
• Acquired by Adobe in 2011 
• Code also given to Apache to create “Cordova” 
• Today 2 projects: Phonegap and Cordova 
• If Cordova = Blink/Webkit then Phonegap = Chrome 
• PhoneGap adds extra features to Cordova (e.g. cloud build) 
• http://cordova.apache.org/ 
• http://phonegap.com/
Single codebase 
Multiple platforms 
img: http://adrocknaphobia.github.io/preso-future-of-mobile/
img: http://chelramsey.com/phonegap-vs-native-builds-a-12-month-review/
How does it work? 
HTML, Javascript, CSS 
PhoneGap Javascript API 
Web browser / UIWebView 
PhoneGap Native Library 
Native Platform 
Mobile app
Getting started 
Java-like 
package 
name 
$ npm install -g cordova 
$ cordova create ./mydemo com.mydemo MyDemo 
$ cd mydemo 
$ cordova platform add android 
$ cordova run android 
Assume 
iOS/Android 
SDK is 
setup 
Pre-requisites: Android SDK, ANDROID_HOME, ant
Folder layout 
config.xml - used to generate iOS/Android config 
hooks/ - actions to run at various points during the build 
platforms/ - apps for each platform, same as normal apps 
plugins/ - cordova/phonegap plugins which add functionality 
www/ - where your HTML, JS and CSS live 
-> platforms/android/assets/www 
-> platforms/ios/www 
-> …
Live-reload = rapid feedback 
• “The PhoneGap Developer App” 
• http://app.phonegap.com/ 
• Available from iOS and Android app stores 
• phonegap serve 
• npm install -g phonegap 
• Watches www/ folder for changes, tells page to reload itself 
• You can test this in a normal browser too 
• There is also cordova serve but not sure what it’s supposed to do
Plugins 
• Allow you to interact with the rest of your device (beyond the web 
browser) through Javascript 
• Plugins usually have 2 components: 
1. Platform-specific native layer (Android, iOS, etc) 
2. Javascript API (used by your app) 
• All standard device features (e.g. contacts, compass, etc) accessed 
through plugins 
• Can also interact with other apps (e.g. Facebook app, Google Maps) 
• Plugin registry: http://plugins.cordova.io/
Adding a plugin 
• Geolocation plugin (lat/long) 
• http://plugins.cordova.io/#/package/ 
org.apache.cordova.geolocation 
• We use navigator.geolocation.watchPosition to get 
the latitude/longitude co-ordinates. 
$ cordova plugin add org.apache.cordova.geolocation 
$ cordova run android …OR… phonegap serve
Live-reload issues 
• PhoneGap Developer App comes with basic plugins - 
geolocation, camera, etc. 
• But what if we want to use a plugin it doesn’t have, e.g. 
Google Maps or our own custom plugin? 
• We can’t use live-reload with phonegap serve… 
• …so we will build the live reload mechanism ourselves!
Live-reload issues 
• PhoneGap Developer App comes with basic plugins - 
geolocation, camera, etc. 
• But what if we want to use a plugin it doesn’t have, e.g. 
Google Maps or our own custom plugin? 
• We can’t use live-reload with phonegap serve… 
• …so we will build the live reload mechanism ourselves!
Use gulp for live-reload 
• gulp-server-livereload - watch for changes and 
send reload signal 
• gulp-replace-task - auto-insert live reload 
host:port into HTML page 
• Demo app 
• https://github.com/hiddentao/phonegap-demo-app
Useful links 
• Ionic framework - http://ionicframework.com 
• Like Twitter Bootstrap but for hybrid apps. 
• Built on Angular.JS 
• Meteor - http://meteor.com/ 
• Isomorphic Javascript framework (built on node.js) 
• Lets you push code update to clients on-the-fly 
• PhoneGap build - https://build.phonegap.com/ 
• Build and packaging done on a cloud server, saves you time and effort 
• Trigger.io - https://trigger.io/ 
• Like PhoneGap but is proprietary and costs money 
• Easier to use than PhoneGap, better plugin integration, etc.
Any Questions? 
“PhoneGap is making the world a 
better place through constructing 
elegant hierarchies for maximum 
code reuse and extensibility”

More Related Content

PPTX
All About Phonegap
PPT
Building Hybrid Applications using PhoneGap
PPTX
Phone gap
PDF
PhoneGap: Building Mobile Applications with HTML/JS
KEY
From mobile browser to mobile app
PPTX
PhoneGap: a brief history and apologia
PDF
Debugging and deploying with phone gap
PDF
Developing with Phonegap - Adobe Refresh 2012
All About Phonegap
Building Hybrid Applications using PhoneGap
Phone gap
PhoneGap: Building Mobile Applications with HTML/JS
From mobile browser to mobile app
PhoneGap: a brief history and apologia
Debugging and deploying with phone gap
Developing with Phonegap - Adobe Refresh 2012

What's hot (19)

KEY
Intro to PhoneGap
PDF
Building Native Mobile Applications with PhoneGap
PDF
PhoneGap Day US 2013 - Chrome Packaged Apps
PPTX
Phone gap
PDF
PhoneGap Talk @ Sencha Con 2010
PDF
Introduction to PhoneGap
ODP
Introduction to PhoneGap
PDF
Cordova / PhoneGap, mobile apps development with HTML5/JS/CSS
PPTX
Building mobile apps using Phonegap
PPTX
Phonegap - An Overview
PPTX
Phonegap
PDF
Building Mobile Cross-Platform Apps with HTML5, jQuery Mobile & PhoneGap
PDF
Cordova and PhoneGap Insights
ODP
Apache Cordova, Hybrid Application Development
PPTX
Wikipedia Mobile App with PhoneGap
KEY
Phonegap/Cordova vs Native Application
PPTX
Hybrid App Development with PhoneGap
PPTX
The Phonegap Architecture
PDF
Hybrid mobile apps
Intro to PhoneGap
Building Native Mobile Applications with PhoneGap
PhoneGap Day US 2013 - Chrome Packaged Apps
Phone gap
PhoneGap Talk @ Sencha Con 2010
Introduction to PhoneGap
Introduction to PhoneGap
Cordova / PhoneGap, mobile apps development with HTML5/JS/CSS
Building mobile apps using Phonegap
Phonegap - An Overview
Phonegap
Building Mobile Cross-Platform Apps with HTML5, jQuery Mobile & PhoneGap
Cordova and PhoneGap Insights
Apache Cordova, Hybrid Application Development
Wikipedia Mobile App with PhoneGap
Phonegap/Cordova vs Native Application
Hybrid App Development with PhoneGap
The Phonegap Architecture
Hybrid mobile apps
Ad

Viewers also liked (18)

PPT
Stop Making The Web Harder Than It Is; Real-world REST, HATEOAS, and Hypermed...
PDF
Dreamweaver CS6, jQuery, PhoneGap, mobile design
PPTX
Intelligent Traffic light detection for individuals with CVD
PDF
REST in Practice
PDF
Ionic by Example
PDF
Polymer - pleasant client-side programming with web components
PDF
Hybrid app development with ionic
PPTX
Introduction to Apache Cordova (Phonegap)
PPTX
OBIEE - Introduction & building reports
PPT
Introduction to OBIEE 11g
PPT
Building Oracle BIEE (OBIEE) Reports, Dashboards
PPTX
Raspberry Pi 3 Latest PPT - Robomart
KEY
HTML5 is the Future of Mobile, PhoneGap Takes You There Today
PPT
Seminar Presentation on raspberry pi
PPTX
Introduction to raspberry pi
PPT
Raspberry pi : an introduction
PPT
Raspberry pi
PPTX
Oracle business intelligence overview
Stop Making The Web Harder Than It Is; Real-world REST, HATEOAS, and Hypermed...
Dreamweaver CS6, jQuery, PhoneGap, mobile design
Intelligent Traffic light detection for individuals with CVD
REST in Practice
Ionic by Example
Polymer - pleasant client-side programming with web components
Hybrid app development with ionic
Introduction to Apache Cordova (Phonegap)
OBIEE - Introduction & building reports
Introduction to OBIEE 11g
Building Oracle BIEE (OBIEE) Reports, Dashboards
Raspberry Pi 3 Latest PPT - Robomart
HTML5 is the Future of Mobile, PhoneGap Takes You There Today
Seminar Presentation on raspberry pi
Introduction to raspberry pi
Raspberry pi : an introduction
Raspberry pi
Oracle business intelligence overview
Ad

Similar to Introduction to PhoneGap (20)

PPTX
PhoneGap - Now and the Future
PDF
Intro to PhoneGap
PDF
Getting started with PhoneGap
PDF
PhoneGap/Cordova
PDF
Webapi
PPTX
Phonegap
PPTX
Intro to PhoneGap
PPTX
Cross Platform Mobile App Development
PPTX
Mobile Development with PhoneGap
PPTX
PhoneGap/PhoneGap Build - Amsterdam Adobe Camp
PPTX
NCDevCon 2017 - Cross Platform Mobile Apps
KEY
Skip the IDE with PhoneGap Build
PDF
Apache Cordova 4.x
PDF
Advanced programing in phonegap
PDF
Introduction phonegap
PPT
"Native" Apps with APEX and PhoneGap
PPTX
Workshop on Hybrid App Development with Ionic Framework
PDF
Hybrid application development
PPTX
Hybrid Mobile Development with Apache Cordova and Java EE 7 (JavaOne 2014)
PDF
Apache Cordova
PhoneGap - Now and the Future
Intro to PhoneGap
Getting started with PhoneGap
PhoneGap/Cordova
Webapi
Phonegap
Intro to PhoneGap
Cross Platform Mobile App Development
Mobile Development with PhoneGap
PhoneGap/PhoneGap Build - Amsterdam Adobe Camp
NCDevCon 2017 - Cross Platform Mobile Apps
Skip the IDE with PhoneGap Build
Apache Cordova 4.x
Advanced programing in phonegap
Introduction phonegap
"Native" Apps with APEX and PhoneGap
Workshop on Hybrid App Development with Ionic Framework
Hybrid application development
Hybrid Mobile Development with Apache Cordova and Java EE 7 (JavaOne 2014)
Apache Cordova

More from RameshNair6 (7)

PDF
solUI Introduction (2019)
PDF
Kickback - incentivizing event attendance through crypto economics
PDF
Introduction to Blockchains
PDF
Javascript ES6 generators
PDF
Introduction to Dart
PDF
ES6 - Next Generation Javascript
ODP
Javascript Update May 2013
solUI Introduction (2019)
Kickback - incentivizing event attendance through crypto economics
Introduction to Blockchains
Javascript ES6 generators
Introduction to Dart
ES6 - Next Generation Javascript
Javascript Update May 2013

Recently uploaded (20)

PDF
Why TechBuilder is the Future of Pickup and Delivery App Development (1).pdf
PDF
Nekopoi APK 2025 free lastest update
PDF
T3DD25 TYPO3 Content Blocks - Deep Dive by André Kraus
PDF
Design an Analysis of Algorithms II-SECS-1021-03
PPTX
history of c programming in notes for students .pptx
PPTX
ai tools demonstartion for schools and inter college
PDF
Design an Analysis of Algorithms I-SECS-1021-03
PPTX
VVF-Customer-Presentation2025-Ver1.9.pptx
PDF
Raksha Bandhan Grocery Pricing Trends in India 2025.pdf
PPTX
Lecture 3: Operating Systems Introduction to Computer Hardware Systems
PDF
Which alternative to Crystal Reports is best for small or large businesses.pdf
PDF
Wondershare Filmora 15 Crack With Activation Key [2025
PDF
Flood Susceptibility Mapping Using Image-Based 2D-CNN Deep Learnin. Overview ...
PDF
How to Migrate SBCGlobal Email to Yahoo Easily
PDF
Internet Downloader Manager (IDM) Crack 6.42 Build 41
PDF
AI in Product Development-omnex systems
PPTX
Agentic AI : A Practical Guide. Undersating, Implementing and Scaling Autono...
PDF
How Creative Agencies Leverage Project Management Software.pdf
PDF
SAP S4 Hana Brochure 3 (PTS SYSTEMS AND SOLUTIONS)
PDF
Odoo Companies in India – Driving Business Transformation.pdf
Why TechBuilder is the Future of Pickup and Delivery App Development (1).pdf
Nekopoi APK 2025 free lastest update
T3DD25 TYPO3 Content Blocks - Deep Dive by André Kraus
Design an Analysis of Algorithms II-SECS-1021-03
history of c programming in notes for students .pptx
ai tools demonstartion for schools and inter college
Design an Analysis of Algorithms I-SECS-1021-03
VVF-Customer-Presentation2025-Ver1.9.pptx
Raksha Bandhan Grocery Pricing Trends in India 2025.pdf
Lecture 3: Operating Systems Introduction to Computer Hardware Systems
Which alternative to Crystal Reports is best for small or large businesses.pdf
Wondershare Filmora 15 Crack With Activation Key [2025
Flood Susceptibility Mapping Using Image-Based 2D-CNN Deep Learnin. Overview ...
How to Migrate SBCGlobal Email to Yahoo Easily
Internet Downloader Manager (IDM) Crack 6.42 Build 41
AI in Product Development-omnex systems
Agentic AI : A Practical Guide. Undersating, Implementing and Scaling Autono...
How Creative Agencies Leverage Project Management Software.pdf
SAP S4 Hana Brochure 3 (PTS SYSTEMS AND SOLUTIONS)
Odoo Companies in India – Driving Business Transformation.pdf

Introduction to PhoneGap

  • 1. Intro to PhoneGap Ramesh Nair / hiddentao Oct 2014 @ Taipei Javascript Enthusiasts
  • 2. What is PhoneGap? • Build mobile apps using HTML5, Javascript and CSS • Created by Nitobi in 2008 • Acquired by Adobe in 2011 • Code also given to Apache to create “Cordova” • Today 2 projects: Phonegap and Cordova • If Cordova = Blink/Webkit then Phonegap = Chrome • PhoneGap adds extra features to Cordova (e.g. cloud build) • http://cordova.apache.org/ • http://phonegap.com/
  • 3. Single codebase Multiple platforms img: http://adrocknaphobia.github.io/preso-future-of-mobile/
  • 5. How does it work? HTML, Javascript, CSS PhoneGap Javascript API Web browser / UIWebView PhoneGap Native Library Native Platform Mobile app
  • 6. Getting started Java-like package name $ npm install -g cordova $ cordova create ./mydemo com.mydemo MyDemo $ cd mydemo $ cordova platform add android $ cordova run android Assume iOS/Android SDK is setup Pre-requisites: Android SDK, ANDROID_HOME, ant
  • 7. Folder layout config.xml - used to generate iOS/Android config hooks/ - actions to run at various points during the build platforms/ - apps for each platform, same as normal apps plugins/ - cordova/phonegap plugins which add functionality www/ - where your HTML, JS and CSS live -> platforms/android/assets/www -> platforms/ios/www -> …
  • 8. Live-reload = rapid feedback • “The PhoneGap Developer App” • http://app.phonegap.com/ • Available from iOS and Android app stores • phonegap serve • npm install -g phonegap • Watches www/ folder for changes, tells page to reload itself • You can test this in a normal browser too • There is also cordova serve but not sure what it’s supposed to do
  • 9. Plugins • Allow you to interact with the rest of your device (beyond the web browser) through Javascript • Plugins usually have 2 components: 1. Platform-specific native layer (Android, iOS, etc) 2. Javascript API (used by your app) • All standard device features (e.g. contacts, compass, etc) accessed through plugins • Can also interact with other apps (e.g. Facebook app, Google Maps) • Plugin registry: http://plugins.cordova.io/
  • 10. Adding a plugin • Geolocation plugin (lat/long) • http://plugins.cordova.io/#/package/ org.apache.cordova.geolocation • We use navigator.geolocation.watchPosition to get the latitude/longitude co-ordinates. $ cordova plugin add org.apache.cordova.geolocation $ cordova run android …OR… phonegap serve
  • 11. Live-reload issues • PhoneGap Developer App comes with basic plugins - geolocation, camera, etc. • But what if we want to use a plugin it doesn’t have, e.g. Google Maps or our own custom plugin? • We can’t use live-reload with phonegap serve… • …so we will build the live reload mechanism ourselves!
  • 12. Live-reload issues • PhoneGap Developer App comes with basic plugins - geolocation, camera, etc. • But what if we want to use a plugin it doesn’t have, e.g. Google Maps or our own custom plugin? • We can’t use live-reload with phonegap serve… • …so we will build the live reload mechanism ourselves!
  • 13. Use gulp for live-reload • gulp-server-livereload - watch for changes and send reload signal • gulp-replace-task - auto-insert live reload host:port into HTML page • Demo app • https://github.com/hiddentao/phonegap-demo-app
  • 14. Useful links • Ionic framework - http://ionicframework.com • Like Twitter Bootstrap but for hybrid apps. • Built on Angular.JS • Meteor - http://meteor.com/ • Isomorphic Javascript framework (built on node.js) • Lets you push code update to clients on-the-fly • PhoneGap build - https://build.phonegap.com/ • Build and packaging done on a cloud server, saves you time and effort • Trigger.io - https://trigger.io/ • Like PhoneGap but is proprietary and costs money • Easier to use than PhoneGap, better plugin integration, etc.
  • 15. Any Questions? “PhoneGap is making the world a better place through constructing elegant hierarchies for maximum code reuse and extensibility”