SlideShare a Scribd company logo
1 of 39
Download to read offline
PhoneGap
Building Native Mobile Apps
using Web Technologies
Andrew Lunny, Nitobi Software
Wednesday, November 17, 2010
What is PhoneGap?
Wednesday, November 17, 2010
How To Build A Mobile App
var	
  idea	
  =	
  "An	
  app	
  to	
  list	
  your	
  todos";
[ios,	
  android,	
  blackberry].forEach(function	
  (platform)	
  {
	
   createMobileApp(idea,	
  platform);
})
//	
  using	
  native	
  APIs	
  and	
  tools
function	
  createMobileApp	
  (idea,	
  platform)	
  {
	
   var	
  app,
	
   	
  	
  	
  	
  profit;
	
   platform.registerForDeveloperProgram();
	
   platform.downloadAndInstallSDK();
	
   platform.learnNativeAPIs();
	
   app	
  =	
  platform.writeNativeApp(idea);
	
   app.buildForPlatform();
	
   profit	
  =	
  app.submitToAppStore();
	
   return	
  profit;
}
Wednesday, November 17, 2010
with PhoneGap
var	
  idea	
  =	
  "An	
  app	
  to	
  list	
  your	
  todos";
var	
  HTML5app	
  =	
  writeAppWithHTML5(idea);
createMobileApp(HTML5app,	
  [ios,	
  android,	
  blackberry]);
//	
  using	
  PhoneGap
function	
  createMobileApp	
  (HTML5app,	
  platforms)	
  {
	
   var	
  app,
	
   	
  	
  	
  	
  profit	
  =	
  0;
	
  	
  	
  	
  	
  platforms.forEach(function	
  (platform)	
  {
	
   platform.registerForDeveloperProgram();
	
   platform.downloadAndInstallSDK();
	
  app	
  =	
  platform.buildNativeAppWithPhoneGap(HTML5app);
	
  app.buildForPlatform();
	
   profit	
  +=	
  app.submitToAppStore();
	
  	
  });
	
   return	
  profit;
}
Wednesday, November 17, 2010
Diff
-­‐	
  	
  [ios,	
  android,	
  blackberry].forEach(function	
  (platform)	
  {
-­‐	
   	
  	
  createMobileApp(idea,	
  platform);
-­‐	
  	
  })
+	
  	
  var	
  HTML5app	
  =	
  writeAppWithHTML5(idea);
+	
  	
  createMobileApp(HTML5app,	
  [ios,	
  android,	
  blackberry]);
-­‐	
   platform.learnNativeAPIs();
-­‐	
   app	
  =	
  platform.writeNativeApp(idea);
+	
   app	
  =	
  platform.buildNativeAppWithPhoneGap(HTML5app);
Wednesday, November 17, 2010
PhoneGap
Web App
HTML5
JavaScript
CSS
Native
APIs
iOS
Android
Black
Berry
webOS
etc...
Wednesday, November 17, 2010
is
Cross-Platform
iOS, Android, BlackBerry 4.6+, webOS, Symbian...
Open Source
MIT outbound, MIT + Apache inbound
Web Technologies
defer to native support
Spec-compliant
where applicable, tracking DAP working group
Extensible
any native code available through plug-ins
any JS libraries available through <script>
Wednesday, November 17, 2010
Strictly Speaking
PhoneGap: the native library
• phonegap.jar, phonegaplib.a, etc
• instantiates chromeless web view, loads www/index.html
• adds JavaScript access to native APIs
There are two parts to PhoneGap
PhoneGap: the JavaScript files
• phonegap.js
• JavaScript wrappers for native API calls
• is not required - your app can run natively as is
Wednesday, November 17, 2010
For Designers
• A PhoneGap app is bigger than a native app on a lot of platforms:
• no location bar
• no browser menu
• There’s no browser chrome!
• interactions should be explicit
• It should have a launch screen
• It should have some icons
• Mobile app expectations != mobile web expectations
Wednesday, November 17, 2010
For Developers
• Write and test your JavaScript as normal
• If you choose to use phonegap.js
• listen for the deviceready event on the document object
• then perform all PhoneGap-specific functionality
• You should be able to avoid native code entirely
• assuming nothing breaks
• if you need extra plug-in functionality, bug us on the mailing list
Wednesday, November 17, 2010
Native APIs
• Device identification
• Network access
• Sensors
• Geo, Accelerometer, Orientation, Magnetometer
• Camera/image sources
• Contacts
• File access
Wednesday, November 17, 2010
Generally Speaking
• PhoneGap is
• agnostic
• permissive
• relaxed
• You don’t have to change the way you write apps
Wednesday, November 17, 2010
Demo Time
• A mobile web app, from Safari to native
apps on
• iPhone
• Android
• webOS
Wednesday, November 17, 2010
Thick Clients
remote APIs
offline storage
view templates
Wednesday, November 17, 2010
If
you put your web app in PhoneGap
Then
you won’t be able to rely on a web server
So
you will have do more on the client
Wednesday, November 17, 2010
Remote APIs
• Usually accessed on a server
• due to the same-origin policy -- best you can do is JSONP
• PhoneGap apps run on the file:// protocol
• the file:// protocol is exempt from the same-origin policy*
• XHRs can point anywhere
• Simple as you like
• $.get()... for example
*well, unless it gets changed. But we’ll patch that if it happens
Wednesday, November 17, 2010
Offline Storage
• HTML5!
• localStorage, sessionStorage, Webkit SQL, Google Gears,
Indexed DB
• Or native storage/external services
• CouchDB!
• Lots of libraries/wrappers
• Ext.data.Store is the Sencha Touch class
• we at Nitobi like Lawnchair
Wednesday, November 17, 2010
View Templating
• If your data’s local, then you’ll render your views locally
• duh
• Sencha does it!
• Or use an opensource one; or roll your own; or whichever
• My favorite is Mustache
• Generally speaking, try to spend time working with Strings, as
opposed to DOM elements
• DOM manipulation is expensive
Wednesday, November 17, 2010
Use Sencha Touch!
You should’ve been at James’s talk
Most of this stuff is taken care of:
make sure you use it!
Wednesday, November 17, 2010
Your server is there to
store data persistently
sync with new devices
let you use the word “cloud” in your marketing
Wednesday, November 17, 2010
Tooling
PhoneGap Build
PhoneGap Dev Browser
Sleight
Wednesday, November 17, 2010
PhoneGap Build
Problem:
Multiple SDKs to install, multiple
operating systems to run them
The crux of cross-platform pain.
Solution:
The cloud!
Ahem.
Online service for building and
distributing PhoneGap apps
Wednesday, November 17, 2010
PhoneGap Build Workflow
• Develop HTML5 app locally:
• index.html
• icon.png
• config.xml
• Submit to PhoneGap Build
• Upload
• Hook into VCS (git, svn)
• Download and Test App Binaries
• Submit programmatically to App Stores
Wednesday, November 17, 2010
Wednesday, November 17, 2010
with PhoneGap Build
var	
  idea	
  =	
  "An	
  app	
  to	
  list	
  your	
  todos";
var	
  HTML5app	
  =	
  writeAppWithHTML5(idea);
var	
  phoneGapBuild	
  =	
  registerAtBuildPhoneGapCom();
createMobileApp(HTML5app,	
  [ios,	
  android,	
  blackberry,	
  symbian,	
  
webos,	
  winPhone7,	
  bada],	
  phoneGapBuild);
//	
  using	
  PhoneGap	
  Build
function	
  createMobileApp	
  (HTML5app,	
  platforms,	
  phoneGapBuild)	
  {
	
   var	
  app,
	
   	
  	
  	
  	
  profit;
	
  	
  	
  	
  platforms.forEach(function	
  (platform)	
  {
	
   platform.registerForDeveloperProgram();
	
  	
  });
	
  	
  //	
  now!
	
  	
  phoneGapBuild.buildNativeAppsInTheCloud(HTML5app);
	
  	
  //	
  soon!
	
  	
  profit	
  =	
  phoneGapBuild.submitToAppStores();
	
   return	
  profit;
}
Wednesday, November 17, 2010
Diff
+	
  	
  var	
  phoneGapBuild	
  =	
  registerAtBuildPhoneGapCom;
-­‐	
  	
  createMobileApp(HTML5app,	
  [ios,	
  android,	
  blackberry]);
+	
  	
  createMobileApp(HTML5app,	
  [ios,	
  android,	
  blackberry,	
  
symbian,	
  webos,	
  winPhone7,	
  bada],	
  phoneGapBuild);
-­‐	
   platform.downloadAndInstallSDK();
-­‐	
   app	
  =	
  platform.buildNativeAppWithPhoneGap(HTML5app);
-­‐	
   app.buildForPlatform();
+	
   phoneGapBuild.buildNativeAppsInTheCloud(HTML5app);
-­‐	
   profit	
  +=	
  app.submitToAppStore();
+	
   profit	
  =	
  phoneGapBuild.submitToAllAppStores();
Wednesday, November 17, 2010
Demo
From GitHub to device
Wednesday, November 17, 2010
PhoneGap Build
Closed beta right now, supporting:
Android, webOS, Symbian, BlackBerry
Next couple of months
• API access to allow IDE integration (Eclipse, Dreamweaver)
• Support for iOS, WinPhone 7, Bada
Further out
• Plugin integration: build with arbitrary native code
• testing/continuous integration
Interested? Sign up for the beta (or harangue me)
Wednesday, November 17, 2010
PhoneGap Dev Browser
Problem:
It takes too long to build apps,
especially compared to web
development.
Who wants to wait for a compiler?
Who wants to reset their device
every time an app is updated?*
Solution:
A browser-style app that includes
PhoneGap APIs.
Put your PhoneGap app on a
remote server, point the browser
to it, test away.
*BlackBerry owners
Wednesday, November 17, 2010
PhoneGap Dev Browser
Available on the Android Market now (free, naturally)
Available on GitHub, more or less, for iOS
who knows, it might get approved
BlackBerry port in progress
Wednesday, November 17, 2010
Sleight
Problem:
We can develop apps with the dev
browsers, but none of our remote
API calls work - because of the
same origin policy.
Solution:
A node-js based web server.
Serve static files from your disk,
proxy remote resources from a
target server.
Wednesday, November 17, 2010
Sleight
Setup:
$ npm install sleight
Usage:
$ cd www
$ sleight port=4000 target=api.twitter.com
More details: https://github.com/alunny/sleight
Wednesday, November 17, 2010
Addenda
releases
roadmap
resources
Wednesday, November 17, 2010
Releases
are not our core competency
Wednesday, November 17, 2010
Currently @ 0.9.3
For most fun, live on edge
Planned for 0.9.4
Unified Contacts API
Unified File/IO API
end of November, tentatively
Wednesday, November 17, 2010
Roadmap
Internationalization
Menu API (once we figure out what this will look like)
Full Windows Phone 7 Support
Plugin packaging/distribution
Beer drinking
Wednesday, November 17, 2010
New Tooling
StopGap
mocking PhoneGap calls in desktop browser
fake touch events, deviceready event
PhoneGap.rb / CLI
build/generate/launch PG apps programmatically
a single unified interface to building apps
Ristretto
build tool for JavaScript
target devices/environments in a framework-agnostic way
Wednesday, November 17, 2010
Resources
http://docs.phonegap.com
http://wiki.phonegap.com
#phonegap on irc.freenode.net
PhoneGap Google Group
twitter.com/phonegap
Wednesday, November 17, 2010
Thanks!
andrew.lunny@nitobi.com
twitter.com/alunny
Wednesday, November 17, 2010

More Related Content

What's hot

Building Native Mobile Applications with PhoneGap
Building Native Mobile Applications with PhoneGapBuilding Native Mobile Applications with PhoneGap
Building Native Mobile Applications with PhoneGapSimon MacDonald
 
PhoneGap: Building Mobile Applications with HTML/JS
PhoneGap: Building Mobile Applications with HTML/JSPhoneGap: Building Mobile Applications with HTML/JS
PhoneGap: Building Mobile Applications with HTML/JSRyan Stewart
 
PhoneGap Day US 2013 - Chrome Packaged Apps
PhoneGap Day US 2013 - Chrome Packaged AppsPhoneGap Day US 2013 - Chrome Packaged Apps
PhoneGap Day US 2013 - Chrome Packaged AppsPhoneGap
 
Cordova and PhoneGap Insights
Cordova and PhoneGap InsightsCordova and PhoneGap Insights
Cordova and PhoneGap InsightsMonaca
 
Apache Cordova, Hybrid Application Development
Apache Cordova, Hybrid Application DevelopmentApache Cordova, Hybrid Application Development
Apache Cordova, Hybrid Application Developmentthedumbterminal
 
PhoneGap - Now and the Future
PhoneGap - Now and the FuturePhoneGap - Now and the Future
PhoneGap - Now and the FutureTim Kim
 
Getting Acquainted with PhoneGap
Getting Acquainted with PhoneGapGetting Acquainted with PhoneGap
Getting Acquainted with PhoneGapJoseph Labrecque
 
Phonegap
PhonegapPhonegap
PhonegapTim Kim
 
Cordova + Ionic + MobileFirst
Cordova + Ionic + MobileFirstCordova + Ionic + MobileFirst
Cordova + Ionic + MobileFirstRaymond Camden
 
Hybrid App Development with PhoneGap
Hybrid App Development with PhoneGapHybrid App Development with PhoneGap
Hybrid App Development with PhoneGapDotitude
 
快快樂樂利用 PhoneGap 打造屬於自己的 App
快快樂樂利用 PhoneGap 打造屬於自己的 App快快樂樂利用 PhoneGap 打造屬於自己的 App
快快樂樂利用 PhoneGap 打造屬於自己的 Appericpi Bi
 
How To Create One App For All Platforms using PhoneGap
How To Create One App For All Platforms using PhoneGapHow To Create One App For All Platforms using PhoneGap
How To Create One App For All Platforms using PhoneGapMobiDev
 
Automating PhoneGap Build
Automating PhoneGap BuildAutomating PhoneGap Build
Automating PhoneGap BuildMatt Gifford
 
Samsung Indonesia: Tizen Wearables
Samsung Indonesia: Tizen WearablesSamsung Indonesia: Tizen Wearables
Samsung Indonesia: Tizen WearablesRyo Jin
 
Workshop on Hybrid App Development with Ionic Framework
Workshop on Hybrid App Development with Ionic FrameworkWorkshop on Hybrid App Development with Ionic Framework
Workshop on Hybrid App Development with Ionic FrameworkAayush Shrestha
 

What's hot (20)

All About Phonegap
All About Phonegap All About Phonegap
All About Phonegap
 
Phone gap
Phone gapPhone gap
Phone gap
 
Building Native Mobile Applications with PhoneGap
Building Native Mobile Applications with PhoneGapBuilding Native Mobile Applications with PhoneGap
Building Native Mobile Applications with PhoneGap
 
PhoneGap: Building Mobile Applications with HTML/JS
PhoneGap: Building Mobile Applications with HTML/JSPhoneGap: Building Mobile Applications with HTML/JS
PhoneGap: Building Mobile Applications with HTML/JS
 
PhoneGap Day US 2013 - Chrome Packaged Apps
PhoneGap Day US 2013 - Chrome Packaged AppsPhoneGap Day US 2013 - Chrome Packaged Apps
PhoneGap Day US 2013 - Chrome Packaged Apps
 
Cordova and PhoneGap Insights
Cordova and PhoneGap InsightsCordova and PhoneGap Insights
Cordova and PhoneGap Insights
 
PhoneGap
PhoneGapPhoneGap
PhoneGap
 
Phonegap
PhonegapPhonegap
Phonegap
 
Phonegap 1.0
Phonegap 1.0Phonegap 1.0
Phonegap 1.0
 
Apache Cordova, Hybrid Application Development
Apache Cordova, Hybrid Application DevelopmentApache Cordova, Hybrid Application Development
Apache Cordova, Hybrid Application Development
 
PhoneGap - Now and the Future
PhoneGap - Now and the FuturePhoneGap - Now and the Future
PhoneGap - Now and the Future
 
Getting Acquainted with PhoneGap
Getting Acquainted with PhoneGapGetting Acquainted with PhoneGap
Getting Acquainted with PhoneGap
 
Phonegap
PhonegapPhonegap
Phonegap
 
Cordova + Ionic + MobileFirst
Cordova + Ionic + MobileFirstCordova + Ionic + MobileFirst
Cordova + Ionic + MobileFirst
 
Hybrid App Development with PhoneGap
Hybrid App Development with PhoneGapHybrid App Development with PhoneGap
Hybrid App Development with PhoneGap
 
快快樂樂利用 PhoneGap 打造屬於自己的 App
快快樂樂利用 PhoneGap 打造屬於自己的 App快快樂樂利用 PhoneGap 打造屬於自己的 App
快快樂樂利用 PhoneGap 打造屬於自己的 App
 
How To Create One App For All Platforms using PhoneGap
How To Create One App For All Platforms using PhoneGapHow To Create One App For All Platforms using PhoneGap
How To Create One App For All Platforms using PhoneGap
 
Automating PhoneGap Build
Automating PhoneGap BuildAutomating PhoneGap Build
Automating PhoneGap Build
 
Samsung Indonesia: Tizen Wearables
Samsung Indonesia: Tizen WearablesSamsung Indonesia: Tizen Wearables
Samsung Indonesia: Tizen Wearables
 
Workshop on Hybrid App Development with Ionic Framework
Workshop on Hybrid App Development with Ionic FrameworkWorkshop on Hybrid App Development with Ionic Framework
Workshop on Hybrid App Development with Ionic Framework
 

Viewers also liked

Structuring Your Sencha Touch Application
Structuring Your Sencha Touch ApplicationStructuring Your Sencha Touch Application
Structuring Your Sencha Touch ApplicationSencha
 
HTML5 is the Future of Mobile, PhoneGap Takes You There Today
HTML5 is the Future of Mobile, PhoneGap Takes You There TodayHTML5 is the Future of Mobile, PhoneGap Takes You There Today
HTML5 is the Future of Mobile, PhoneGap Takes You There Todaydavyjones
 
Introduction To Multimedia
Introduction To MultimediaIntroduction To Multimedia
Introduction To MultimediaJomel Penalba
 
DATA WAREHOUSING
DATA WAREHOUSINGDATA WAREHOUSING
DATA WAREHOUSINGKing Julian
 
Chapter 1 : INTRODUCTION TO MULTIMEDIA
Chapter 1 : INTRODUCTION TO MULTIMEDIAChapter 1 : INTRODUCTION TO MULTIMEDIA
Chapter 1 : INTRODUCTION TO MULTIMEDIAazira96
 
ppt on LIFI TECHNOLOGY
ppt on LIFI TECHNOLOGYppt on LIFI TECHNOLOGY
ppt on LIFI TECHNOLOGYtanshu singh
 
Presentation on 1G/2G/3G/4G/5G/Cellular & Wireless Technologies
Presentation on 1G/2G/3G/4G/5G/Cellular & Wireless TechnologiesPresentation on 1G/2G/3G/4G/5G/Cellular & Wireless Technologies
Presentation on 1G/2G/3G/4G/5G/Cellular & Wireless TechnologiesKaushal Kaith
 

Viewers also liked (12)

Structuring Your Sencha Touch Application
Structuring Your Sencha Touch ApplicationStructuring Your Sencha Touch Application
Structuring Your Sencha Touch Application
 
3g 4g ppt
3g 4g ppt3g 4g ppt
3g 4g ppt
 
HTML5 is the Future of Mobile, PhoneGap Takes You There Today
HTML5 is the Future of Mobile, PhoneGap Takes You There TodayHTML5 is the Future of Mobile, PhoneGap Takes You There Today
HTML5 is the Future of Mobile, PhoneGap Takes You There Today
 
Multimedia ppt
Multimedia pptMultimedia ppt
Multimedia ppt
 
Introduction To Multimedia
Introduction To MultimediaIntroduction To Multimedia
Introduction To Multimedia
 
Lifi ppt
Lifi pptLifi ppt
Lifi ppt
 
DATA WAREHOUSING
DATA WAREHOUSINGDATA WAREHOUSING
DATA WAREHOUSING
 
Chapter 1 : INTRODUCTION TO MULTIMEDIA
Chapter 1 : INTRODUCTION TO MULTIMEDIAChapter 1 : INTRODUCTION TO MULTIMEDIA
Chapter 1 : INTRODUCTION TO MULTIMEDIA
 
Multimedia
MultimediaMultimedia
Multimedia
 
ppt on LIFI TECHNOLOGY
ppt on LIFI TECHNOLOGYppt on LIFI TECHNOLOGY
ppt on LIFI TECHNOLOGY
 
Presentation on 1G/2G/3G/4G/5G/Cellular & Wireless Technologies
Presentation on 1G/2G/3G/4G/5G/Cellular & Wireless TechnologiesPresentation on 1G/2G/3G/4G/5G/Cellular & Wireless Technologies
Presentation on 1G/2G/3G/4G/5G/Cellular & Wireless Technologies
 
Slideshare ppt
Slideshare pptSlideshare ppt
Slideshare ppt
 

Similar to PhoneGap Talk @ Sencha Con 2010

Phonegap - An Introduction
Phonegap - An IntroductionPhonegap - An Introduction
Phonegap - An IntroductionTyler Johnston
 
PhoneGap/PhoneGap Build - Amsterdam Adobe Camp
PhoneGap/PhoneGap Build - Amsterdam Adobe CampPhoneGap/PhoneGap Build - Amsterdam Adobe Camp
PhoneGap/PhoneGap Build - Amsterdam Adobe CampMihai Corlan
 
Getting started with PhoneGap
Getting started with PhoneGapGetting started with PhoneGap
Getting started with PhoneGapMihai Corlan
 
Developing Windows Phone 8 apps using PhoneGap
Developing Windows Phone 8 apps using PhoneGapDeveloping Windows Phone 8 apps using PhoneGap
Developing Windows Phone 8 apps using PhoneGapAmar Mesic
 
Cross-platform Mobile Development on Open Source
Cross-platform Mobile Development on Open SourceCross-platform Mobile Development on Open Source
Cross-platform Mobile Development on Open SourceAll Things Open
 
HTML5 Can't Do That
HTML5 Can't Do ThatHTML5 Can't Do That
HTML5 Can't Do ThatNathan Smith
 
Appcelerator Titanium Intro
Appcelerator Titanium IntroAppcelerator Titanium Intro
Appcelerator Titanium IntroNicholas Jansma
 
Cross-Platform Mobile Development with PhoneGap-Vince Bullinger
Cross-Platform Mobile Development with PhoneGap-Vince BullingerCross-Platform Mobile Development with PhoneGap-Vince Bullinger
Cross-Platform Mobile Development with PhoneGap-Vince BullingerMobile March
 
Building Mobile Cross-Platform Apps with HTML5, jQuery Mobile & PhoneGap
Building Mobile Cross-Platform Apps with HTML5, jQuery Mobile & PhoneGapBuilding Mobile Cross-Platform Apps with HTML5, jQuery Mobile & PhoneGap
Building Mobile Cross-Platform Apps with HTML5, jQuery Mobile & PhoneGapNick Landry
 
Mobile ECM with JavaScript - JSE 2011
Mobile ECM with JavaScript - JSE 2011Mobile ECM with JavaScript - JSE 2011
Mobile ECM with JavaScript - JSE 2011Nuxeo
 
Introduction to Cross-Platform Hybrid Mobile App Development
Introduction to Cross-Platform Hybrid Mobile App DevelopmentIntroduction to Cross-Platform Hybrid Mobile App Development
Introduction to Cross-Platform Hybrid Mobile App DevelopmentÖzcan Zafer AYAN
 
Making the Mobile Web Native with PhoneGap
Making the Mobile Web Native with PhoneGapMaking the Mobile Web Native with PhoneGap
Making the Mobile Web Native with PhoneGapRoy Clarkson
 
«I knew there had to be a better way to build mobile app»​
«I knew there had to be a better way to build mobile app»​«I knew there had to be a better way to build mobile app»​
«I knew there had to be a better way to build mobile app»​FDConf
 

Similar to PhoneGap Talk @ Sencha Con 2010 (20)

Getting started with PhoneGap
Getting started with PhoneGapGetting started with PhoneGap
Getting started with PhoneGap
 
Future of Mobile
Future of MobileFuture of Mobile
Future of Mobile
 
Intro to PhoneGap
Intro to PhoneGapIntro to PhoneGap
Intro to PhoneGap
 
Phonegap - An Introduction
Phonegap - An IntroductionPhonegap - An Introduction
Phonegap - An Introduction
 
PhoneGap/PhoneGap Build - Amsterdam Adobe Camp
PhoneGap/PhoneGap Build - Amsterdam Adobe CampPhoneGap/PhoneGap Build - Amsterdam Adobe Camp
PhoneGap/PhoneGap Build - Amsterdam Adobe Camp
 
Txjs
TxjsTxjs
Txjs
 
Getting started with PhoneGap
Getting started with PhoneGapGetting started with PhoneGap
Getting started with PhoneGap
 
Developing Windows Phone 8 apps using PhoneGap
Developing Windows Phone 8 apps using PhoneGapDeveloping Windows Phone 8 apps using PhoneGap
Developing Windows Phone 8 apps using PhoneGap
 
Intro to PhoneGap
Intro to PhoneGapIntro to PhoneGap
Intro to PhoneGap
 
Cross-platform Mobile Development on Open Source
Cross-platform Mobile Development on Open SourceCross-platform Mobile Development on Open Source
Cross-platform Mobile Development on Open Source
 
HTML5 Can't Do That
HTML5 Can't Do ThatHTML5 Can't Do That
HTML5 Can't Do That
 
Appcelerator Titanium Intro
Appcelerator Titanium IntroAppcelerator Titanium Intro
Appcelerator Titanium Intro
 
Cross-Platform Mobile Development with PhoneGap-Vince Bullinger
Cross-Platform Mobile Development with PhoneGap-Vince BullingerCross-Platform Mobile Development with PhoneGap-Vince Bullinger
Cross-Platform Mobile Development with PhoneGap-Vince Bullinger
 
Building Mobile Cross-Platform Apps with HTML5, jQuery Mobile & PhoneGap
Building Mobile Cross-Platform Apps with HTML5, jQuery Mobile & PhoneGapBuilding Mobile Cross-Platform Apps with HTML5, jQuery Mobile & PhoneGap
Building Mobile Cross-Platform Apps with HTML5, jQuery Mobile & PhoneGap
 
Mobile ECM with JavaScript - JSE 2011
Mobile ECM with JavaScript - JSE 2011Mobile ECM with JavaScript - JSE 2011
Mobile ECM with JavaScript - JSE 2011
 
Mobile native-hacks
Mobile native-hacksMobile native-hacks
Mobile native-hacks
 
Introduction to Cross-Platform Hybrid Mobile App Development
Introduction to Cross-Platform Hybrid Mobile App DevelopmentIntroduction to Cross-Platform Hybrid Mobile App Development
Introduction to Cross-Platform Hybrid Mobile App Development
 
Making the Mobile Web Native with PhoneGap
Making the Mobile Web Native with PhoneGapMaking the Mobile Web Native with PhoneGap
Making the Mobile Web Native with PhoneGap
 
PhoneGap/Cordova
PhoneGap/CordovaPhoneGap/Cordova
PhoneGap/Cordova
 
«I knew there had to be a better way to build mobile app»​
«I knew there had to be a better way to build mobile app»​«I knew there had to be a better way to build mobile app»​
«I knew there had to be a better way to build mobile app»​
 

Recently uploaded

Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...DianaGray10
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businesspanagenda
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?Igalia
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProduct Anonymous
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...Neo4j
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Drew Madelung
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonAnna Loughnan Colquhoun
 
Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyKhushali Kathiriya
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...apidays
 
Manulife - Insurer Innovation Award 2024
Manulife - Insurer Innovation Award 2024Manulife - Insurer Innovation Award 2024
Manulife - Insurer Innovation Award 2024The Digital Insurer
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationRadu Cotescu
 
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...apidays
 
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodJuan lago vázquez
 
HTML Injection Attacks: Impact and Mitigation Strategies
HTML Injection Attacks: Impact and Mitigation StrategiesHTML Injection Attacks: Impact and Mitigation Strategies
HTML Injection Attacks: Impact and Mitigation StrategiesBoston Institute of Analytics
 
GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdflior mazor
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Scriptwesley chun
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FMESafe Software
 
Top 10 Most Downloaded Games on Play Store in 2024
Top 10 Most Downloaded Games on Play Store in 2024Top 10 Most Downloaded Games on Play Store in 2024
Top 10 Most Downloaded Games on Play Store in 2024SynarionITSolutions
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processorsdebabhi2
 

Recently uploaded (20)

Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : Uncertainty
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 
Manulife - Insurer Innovation Award 2024
Manulife - Insurer Innovation Award 2024Manulife - Insurer Innovation Award 2024
Manulife - Insurer Innovation Award 2024
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
 
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
 
HTML Injection Attacks: Impact and Mitigation Strategies
HTML Injection Attacks: Impact and Mitigation StrategiesHTML Injection Attacks: Impact and Mitigation Strategies
HTML Injection Attacks: Impact and Mitigation Strategies
 
GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdf
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
Top 10 Most Downloaded Games on Play Store in 2024
Top 10 Most Downloaded Games on Play Store in 2024Top 10 Most Downloaded Games on Play Store in 2024
Top 10 Most Downloaded Games on Play Store in 2024
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 

PhoneGap Talk @ Sencha Con 2010

  • 1. PhoneGap Building Native Mobile Apps using Web Technologies Andrew Lunny, Nitobi Software Wednesday, November 17, 2010
  • 2. What is PhoneGap? Wednesday, November 17, 2010
  • 3. How To Build A Mobile App var  idea  =  "An  app  to  list  your  todos"; [ios,  android,  blackberry].forEach(function  (platform)  {   createMobileApp(idea,  platform); }) //  using  native  APIs  and  tools function  createMobileApp  (idea,  platform)  {   var  app,          profit;   platform.registerForDeveloperProgram();   platform.downloadAndInstallSDK();   platform.learnNativeAPIs();   app  =  platform.writeNativeApp(idea);   app.buildForPlatform();   profit  =  app.submitToAppStore();   return  profit; } Wednesday, November 17, 2010
  • 4. with PhoneGap var  idea  =  "An  app  to  list  your  todos"; var  HTML5app  =  writeAppWithHTML5(idea); createMobileApp(HTML5app,  [ios,  android,  blackberry]); //  using  PhoneGap function  createMobileApp  (HTML5app,  platforms)  {   var  app,          profit  =  0;          platforms.forEach(function  (platform)  {   platform.registerForDeveloperProgram();   platform.downloadAndInstallSDK();  app  =  platform.buildNativeAppWithPhoneGap(HTML5app);  app.buildForPlatform();   profit  +=  app.submitToAppStore();    });   return  profit; } Wednesday, November 17, 2010
  • 5. Diff -­‐    [ios,  android,  blackberry].forEach(function  (platform)  { -­‐      createMobileApp(idea,  platform); -­‐    }) +    var  HTML5app  =  writeAppWithHTML5(idea); +    createMobileApp(HTML5app,  [ios,  android,  blackberry]); -­‐   platform.learnNativeAPIs(); -­‐   app  =  platform.writeNativeApp(idea); +   app  =  platform.buildNativeAppWithPhoneGap(HTML5app); Wednesday, November 17, 2010
  • 7. is Cross-Platform iOS, Android, BlackBerry 4.6+, webOS, Symbian... Open Source MIT outbound, MIT + Apache inbound Web Technologies defer to native support Spec-compliant where applicable, tracking DAP working group Extensible any native code available through plug-ins any JS libraries available through <script> Wednesday, November 17, 2010
  • 8. Strictly Speaking PhoneGap: the native library • phonegap.jar, phonegaplib.a, etc • instantiates chromeless web view, loads www/index.html • adds JavaScript access to native APIs There are two parts to PhoneGap PhoneGap: the JavaScript files • phonegap.js • JavaScript wrappers for native API calls • is not required - your app can run natively as is Wednesday, November 17, 2010
  • 9. For Designers • A PhoneGap app is bigger than a native app on a lot of platforms: • no location bar • no browser menu • There’s no browser chrome! • interactions should be explicit • It should have a launch screen • It should have some icons • Mobile app expectations != mobile web expectations Wednesday, November 17, 2010
  • 10. For Developers • Write and test your JavaScript as normal • If you choose to use phonegap.js • listen for the deviceready event on the document object • then perform all PhoneGap-specific functionality • You should be able to avoid native code entirely • assuming nothing breaks • if you need extra plug-in functionality, bug us on the mailing list Wednesday, November 17, 2010
  • 11. Native APIs • Device identification • Network access • Sensors • Geo, Accelerometer, Orientation, Magnetometer • Camera/image sources • Contacts • File access Wednesday, November 17, 2010
  • 12. Generally Speaking • PhoneGap is • agnostic • permissive • relaxed • You don’t have to change the way you write apps Wednesday, November 17, 2010
  • 13. Demo Time • A mobile web app, from Safari to native apps on • iPhone • Android • webOS Wednesday, November 17, 2010
  • 14. Thick Clients remote APIs offline storage view templates Wednesday, November 17, 2010
  • 15. If you put your web app in PhoneGap Then you won’t be able to rely on a web server So you will have do more on the client Wednesday, November 17, 2010
  • 16. Remote APIs • Usually accessed on a server • due to the same-origin policy -- best you can do is JSONP • PhoneGap apps run on the file:// protocol • the file:// protocol is exempt from the same-origin policy* • XHRs can point anywhere • Simple as you like • $.get()... for example *well, unless it gets changed. But we’ll patch that if it happens Wednesday, November 17, 2010
  • 17. Offline Storage • HTML5! • localStorage, sessionStorage, Webkit SQL, Google Gears, Indexed DB • Or native storage/external services • CouchDB! • Lots of libraries/wrappers • Ext.data.Store is the Sencha Touch class • we at Nitobi like Lawnchair Wednesday, November 17, 2010
  • 18. View Templating • If your data’s local, then you’ll render your views locally • duh • Sencha does it! • Or use an opensource one; or roll your own; or whichever • My favorite is Mustache • Generally speaking, try to spend time working with Strings, as opposed to DOM elements • DOM manipulation is expensive Wednesday, November 17, 2010
  • 19. Use Sencha Touch! You should’ve been at James’s talk Most of this stuff is taken care of: make sure you use it! Wednesday, November 17, 2010
  • 20. Your server is there to store data persistently sync with new devices let you use the word “cloud” in your marketing Wednesday, November 17, 2010
  • 21. Tooling PhoneGap Build PhoneGap Dev Browser Sleight Wednesday, November 17, 2010
  • 22. PhoneGap Build Problem: Multiple SDKs to install, multiple operating systems to run them The crux of cross-platform pain. Solution: The cloud! Ahem. Online service for building and distributing PhoneGap apps Wednesday, November 17, 2010
  • 23. PhoneGap Build Workflow • Develop HTML5 app locally: • index.html • icon.png • config.xml • Submit to PhoneGap Build • Upload • Hook into VCS (git, svn) • Download and Test App Binaries • Submit programmatically to App Stores Wednesday, November 17, 2010
  • 25. with PhoneGap Build var  idea  =  "An  app  to  list  your  todos"; var  HTML5app  =  writeAppWithHTML5(idea); var  phoneGapBuild  =  registerAtBuildPhoneGapCom(); createMobileApp(HTML5app,  [ios,  android,  blackberry,  symbian,   webos,  winPhone7,  bada],  phoneGapBuild); //  using  PhoneGap  Build function  createMobileApp  (HTML5app,  platforms,  phoneGapBuild)  {   var  app,          profit;        platforms.forEach(function  (platform)  {   platform.registerForDeveloperProgram();    });    //  now!    phoneGapBuild.buildNativeAppsInTheCloud(HTML5app);    //  soon!    profit  =  phoneGapBuild.submitToAppStores();   return  profit; } Wednesday, November 17, 2010
  • 26. Diff +    var  phoneGapBuild  =  registerAtBuildPhoneGapCom; -­‐    createMobileApp(HTML5app,  [ios,  android,  blackberry]); +    createMobileApp(HTML5app,  [ios,  android,  blackberry,   symbian,  webos,  winPhone7,  bada],  phoneGapBuild); -­‐   platform.downloadAndInstallSDK(); -­‐   app  =  platform.buildNativeAppWithPhoneGap(HTML5app); -­‐   app.buildForPlatform(); +   phoneGapBuild.buildNativeAppsInTheCloud(HTML5app); -­‐   profit  +=  app.submitToAppStore(); +   profit  =  phoneGapBuild.submitToAllAppStores(); Wednesday, November 17, 2010
  • 27. Demo From GitHub to device Wednesday, November 17, 2010
  • 28. PhoneGap Build Closed beta right now, supporting: Android, webOS, Symbian, BlackBerry Next couple of months • API access to allow IDE integration (Eclipse, Dreamweaver) • Support for iOS, WinPhone 7, Bada Further out • Plugin integration: build with arbitrary native code • testing/continuous integration Interested? Sign up for the beta (or harangue me) Wednesday, November 17, 2010
  • 29. PhoneGap Dev Browser Problem: It takes too long to build apps, especially compared to web development. Who wants to wait for a compiler? Who wants to reset their device every time an app is updated?* Solution: A browser-style app that includes PhoneGap APIs. Put your PhoneGap app on a remote server, point the browser to it, test away. *BlackBerry owners Wednesday, November 17, 2010
  • 30. PhoneGap Dev Browser Available on the Android Market now (free, naturally) Available on GitHub, more or less, for iOS who knows, it might get approved BlackBerry port in progress Wednesday, November 17, 2010
  • 31. Sleight Problem: We can develop apps with the dev browsers, but none of our remote API calls work - because of the same origin policy. Solution: A node-js based web server. Serve static files from your disk, proxy remote resources from a target server. Wednesday, November 17, 2010
  • 32. Sleight Setup: $ npm install sleight Usage: $ cd www $ sleight port=4000 target=api.twitter.com More details: https://github.com/alunny/sleight Wednesday, November 17, 2010
  • 34. Releases are not our core competency Wednesday, November 17, 2010
  • 35. Currently @ 0.9.3 For most fun, live on edge Planned for 0.9.4 Unified Contacts API Unified File/IO API end of November, tentatively Wednesday, November 17, 2010
  • 36. Roadmap Internationalization Menu API (once we figure out what this will look like) Full Windows Phone 7 Support Plugin packaging/distribution Beer drinking Wednesday, November 17, 2010
  • 37. New Tooling StopGap mocking PhoneGap calls in desktop browser fake touch events, deviceready event PhoneGap.rb / CLI build/generate/launch PG apps programmatically a single unified interface to building apps Ristretto build tool for JavaScript target devices/environments in a framework-agnostic way Wednesday, November 17, 2010
  • 38. Resources http://docs.phonegap.com http://wiki.phonegap.com #phonegap on irc.freenode.net PhoneGap Google Group twitter.com/phonegap Wednesday, November 17, 2010