Native Javascript apps with PhoneGap 11-04-2014 Codemotion Rome

Martin de Keijzer
Martin de KeijzerWeb developer at Ibuildings
Phonegap
Martin de Keijzer
Codemotion- April 11, 2014 - The Netherlands
Native Javascript apps with
Introduction
2
About me
Martin de Keijzer
Dutch web developer
3
@Martin1982
PHPBenelux Board Member
Working for Ibuildings
http://www.martindekeijzer.nl
What is PhoneGap?
4
5
What is PhoneGap
A way to wrap your HTML
app as a native application.
6
What is PhoneGap
A way to bridge ‘Native’ functionality to a Javascript API
7
Mission
PhoneGap’s mission is for 	

PhoneGap to cease to exist!
8
Cordova, PhoneGap
WTF?!?!?
History class
9
PhoneGap Pre-Adobe
10
by
PhoneGap acquisistion by Adobe
11
Acquired by
Donated to
Acquisition by Adobe
12
“PhoneGap” “Callback”
“Cordova”
PhoneGap now
13
Where changes get committed
PhoneGap now
14
PhoneGap releases, still identical to
Apache Cordova
In conclusion
15
You’ll use PhoneGap!
16
Running PhoneGap
Getting ready for lift-off
Getting the PhoneGap software
17
sudo npm install -g phonegap
Creating a project
18
phonegap create <projectname>
Running the scaffold
19
phonegap run ios
Your app
20
Copy your html/css/javascript to the ‘www’ folder always
include an index.html in the root
REMEMBER: Files run from a filesystem not a webserver!
PhoneGap per platform commands
21
install - install a platform SDK to the project	

run - run your project on a certain platform	

build - build a distributable package for a platform
When the web just doesn’t suffice
Plug-ins
22
Plugin management
Add a new plugin:
phonegap plugin add org.apache.cordova.inappbrowser
!
!
!
List added plugin(s):
phonegap plugin ls
!
!
!
!
Remove a plugin:
phonegap plugin remove org.apache.cordova.inappbrowser
23
24
Notification
•Alert	

•Confirmation	

•Beep	

•Vibrate
Notification
navigator.notification.vibrate(2500);
25
26
Camera, Capture & Media
Use the device’s library,
camera and microphone to
work with local audio, video
and images.
Camera, Capture & Media
function onSuccess(imageData) { // Do stuff with the image!
}
function onFail(message) {
alert('Failed to get the picture: ' + message);
}
var cameraPopoverHandle = navigator.camera.getPicture(onSuccess,
onFail, { destinationType: Camera.DestinationType.FILE_URI,
sourceType: Camera.PictureSourceType.PHOTOLIBRARY });
!
// Reposition the popover if the orientation changes.
window.onorientationchange = function() {
var cameraPopoverOptions = new CameraPopoverOptions(0, 0,
100, 100, 0);
cameraPopoverHandle.setPosition(cameraPopoverOptions);
}
27
28
Contacts
Access the user’s contact list
Contacts
// Wait for device API libraries to load
//
document.addEventListener("deviceready", onDeviceReady,
false);
!
// device APIs are available
//
function onDeviceReady() {
var options = new ContactFindOptions();
options.filter="";
filter = ["displayName","organizations"];
navigator.contacts.find(filter, onSuccess, onError,
options);
}
29
30
InAppBrowser
The browser opened by
window.open()
Extremely useful to open	

external links!
InAppBrowser
var ref = window.open('http://apache.org', '_blank',
‘location=yes');
!
// close InAppBrowser after 5 seconds
setTimeout(function() {
ref.close();
}, 5000);
31
32
Full API Documentation
http://docs.phonegap.com
Why reinvent the wheel
User plugins
33
34
Pick what you want
http://plugins.cordova.io/#/_browse/all
Go Pro
Create your own plugins
35
Disclaimer: Native knowledge is a requirement
Let’s take it easy
PhoneGap build
36
37
PhoneGap build to the rescue!
http://build.phonegap.com
38
PhoneGap build in a nutshell
39
Getting started
OR
40
Getting started
41
Getting started
OR
Repository that represents

“www”
Zip-file that represents

“www”
42
Getting started
43
The power of PhoneGap Build
Title
Code
Metadata Test
44
Build statusses
Grey: Still building, be patient	

Blue-ish: Build succeeded, click to download	

Red: Build error, action required
45
Build errors
46
Working in teams
47
Building like a pro
config.xml	

W3C Widget Specification
https://gist.github.com/Martin1982/5063962
Now it’s your turn
Conclusion
48
Conclusion
49
Package web applications as native apps
Enrich applications with native plugins
Quick deployment with PhoneGap Build VS.
fine-tuned deployment with PhoneGap CLI
tools / IDE
If it doesn’t fit the bill? Download or write your
own plugin!
Always remember; your app runs as a local
QUESTIONS
50
mdkeijzer@ibuildings.nl
@Martin1982
Thank you for listening
Creative Commons License
This work is licensed under a Creative Commons Attribution-
NonCommercial-ShareAlike 3.0 Unported License.
Slides can also be found at:	

http://www.slideshare.net/Martin82
1 of 51

Recommended

MobileConf 2015: Desmistificando o Phonegap (Cordova) by
MobileConf 2015: Desmistificando o Phonegap (Cordova)MobileConf 2015: Desmistificando o Phonegap (Cordova)
MobileConf 2015: Desmistificando o Phonegap (Cordova)Loiane Groner
1.1K views73 slides
OpenLayers 3 & Google Closure Compiler by
OpenLayers 3 & Google Closure CompilerOpenLayers 3 & Google Closure Compiler
OpenLayers 3 & Google Closure CompilerCamptocamp
1.1K views31 slides
api-platform: the ultimate API platform by
api-platform: the ultimate API platformapi-platform: the ultimate API platform
api-platform: the ultimate API platformStefan Adolf
1.3K views65 slides
Bpstudy48 by
Bpstudy48Bpstudy48
Bpstudy48Mitsuhiro Setoguchi
423 views17 slides
PhpSpec extension points by
PhpSpec extension pointsPhpSpec extension points
PhpSpec extension pointsNorbert Orzechowicz
2.4K views56 slides
Intro to Silex by
Intro to SilexIntro to Silex
Intro to SilexJoey Rivera
607 views12 slides

More Related Content

Similar to Native Javascript apps with PhoneGap 11-04-2014 Codemotion Rome

Intro to PhoneGap by
Intro to PhoneGapIntro to PhoneGap
Intro to PhoneGapRyan Stewart
1.3K views55 slides
Firefox OS - HTML5 for a truly world-wide-web by
Firefox OS - HTML5 for a truly world-wide-webFirefox OS - HTML5 for a truly world-wide-web
Firefox OS - HTML5 for a truly world-wide-webChristian Heilmann
5.2K views79 slides
Firefox OS, a startup opportunity - Mobile Startups Toronto & HTML Toronto me... by
Firefox OS, a startup opportunity - Mobile Startups Toronto & HTML Toronto me...Firefox OS, a startup opportunity - Mobile Startups Toronto & HTML Toronto me...
Firefox OS, a startup opportunity - Mobile Startups Toronto & HTML Toronto me...Frédéric Harper
2.2K views68 slides
Firefox OS - Answering global challenges by
Firefox OS - Answering global challengesFirefox OS - Answering global challenges
Firefox OS - Answering global challengesChristian Heilmann
31.1K views77 slides
(Christian heilman) firefox by
(Christian heilman) firefox(Christian heilman) firefox
(Christian heilman) firefoxNAVER D2
1.5K views60 slides
Appium solution by
Appium solutionAppium solution
Appium solutionNael Abd Eljawad
1.3K views62 slides

Similar to Native Javascript apps with PhoneGap 11-04-2014 Codemotion Rome(20)

Intro to PhoneGap by Ryan Stewart
Intro to PhoneGapIntro to PhoneGap
Intro to PhoneGap
Ryan Stewart1.3K views
Firefox OS - HTML5 for a truly world-wide-web by Christian Heilmann
Firefox OS - HTML5 for a truly world-wide-webFirefox OS - HTML5 for a truly world-wide-web
Firefox OS - HTML5 for a truly world-wide-web
Christian Heilmann5.2K views
Firefox OS, a startup opportunity - Mobile Startups Toronto & HTML Toronto me... by Frédéric Harper
Firefox OS, a startup opportunity - Mobile Startups Toronto & HTML Toronto me...Firefox OS, a startup opportunity - Mobile Startups Toronto & HTML Toronto me...
Firefox OS, a startup opportunity - Mobile Startups Toronto & HTML Toronto me...
Frédéric Harper2.2K views
Firefox OS - Answering global challenges by Christian Heilmann
Firefox OS - Answering global challengesFirefox OS - Answering global challenges
Firefox OS - Answering global challenges
Christian Heilmann31.1K views
(Christian heilman) firefox by NAVER D2
(Christian heilman) firefox(Christian heilman) firefox
(Christian heilman) firefox
NAVER D21.5K views
Bringing the open web and APIs to mobile devices with Firefox OS - Whisky W... by Robert Nyman
 	Bringing the open web and APIs to mobile devices with Firefox OS - Whisky W... 	Bringing the open web and APIs to mobile devices with Firefox OS - Whisky W...
Bringing the open web and APIs to mobile devices with Firefox OS - Whisky W...
Robert Nyman7K views
Fixing the mobile web - Internet World Romania by Christian Heilmann
Fixing the mobile web - Internet World RomaniaFixing the mobile web - Internet World Romania
Fixing the mobile web - Internet World Romania
Christian Heilmann11K views
Introduction to PhoneGap by degarden
Introduction to PhoneGapIntroduction to PhoneGap
Introduction to PhoneGap
degarden4.2K views
Web APIs & Apps - Mozilla by Robert Nyman
Web APIs & Apps - MozillaWeb APIs & Apps - Mozilla
Web APIs & Apps - Mozilla
Robert Nyman17.6K views
Introduction to Apache Cordova (Phonegap) by ejlp12
Introduction to Apache Cordova (Phonegap)Introduction to Apache Cordova (Phonegap)
Introduction to Apache Cordova (Phonegap)
ejlp1232.4K views
PHP and Platform Independance in the Cloud by ZendCon
PHP and Platform Independance in the CloudPHP and Platform Independance in the Cloud
PHP and Platform Independance in the Cloud
ZendCon1.3K views
WebAPIs & Apps - Mozilla London by Robert Nyman
WebAPIs & Apps - Mozilla LondonWebAPIs & Apps - Mozilla London
WebAPIs & Apps - Mozilla London
Robert Nyman30.7K views
PhoneGap - Now and the Future by Tim Kim
PhoneGap - Now and the FuturePhoneGap - Now and the Future
PhoneGap - Now and the Future
Tim Kim2.4K views
Developing Native Mobile Apps Using JavaScript, ApacheCon NA 2014 by Hazem Saleh
Developing Native Mobile Apps Using JavaScript, ApacheCon NA 2014Developing Native Mobile Apps Using JavaScript, ApacheCon NA 2014
Developing Native Mobile Apps Using JavaScript, ApacheCon NA 2014
Hazem Saleh3.9K views
Firefox OS: HTML5 sur les stéroïdes - HTML5mtl - 2014-04-22 by Frédéric Harper
Firefox OS: HTML5 sur les stéroïdes - HTML5mtl - 2014-04-22Firefox OS: HTML5 sur les stéroïdes - HTML5mtl - 2014-04-22
Firefox OS: HTML5 sur les stéroïdes - HTML5mtl - 2014-04-22
Frédéric Harper1.3K views
Phone gap by Ali Dany
Phone gapPhone gap
Phone gap
Ali Dany921 views
BarCamp KL H20 Open Social Hackathon by marvin337
BarCamp KL H20 Open Social HackathonBarCamp KL H20 Open Social Hackathon
BarCamp KL H20 Open Social Hackathon
marvin337295 views
Phone gap 12 things you should know by ISOCHK
Phone gap 12 things you should knowPhone gap 12 things you should know
Phone gap 12 things you should know
ISOCHK5.2K views
PhoneGap:你应该知道的12件事 by longfei.dong
PhoneGap:你应该知道的12件事PhoneGap:你应该知道的12件事
PhoneGap:你应该知道的12件事
longfei.dong2.1K views

More from Martin de Keijzer

High quality live broadcasting with PHP 27 07-2016 by
High quality live broadcasting with PHP 27 07-2016High quality live broadcasting with PHP 27 07-2016
High quality live broadcasting with PHP 27 07-2016Martin de Keijzer
739 views55 slides
Productive & easy mobile app dev by
Productive & easy mobile app devProductive & easy mobile app dev
Productive & easy mobile app devMartin de Keijzer
992 views51 slides
tiCONF Amsterdam 2014 building mobile teams by
tiCONF Amsterdam 2014   building mobile teamstiCONF Amsterdam 2014   building mobile teams
tiCONF Amsterdam 2014 building mobile teamsMartin de Keijzer
2.4K views46 slides
The Environment Restaurant by
The Environment RestaurantThe Environment Restaurant
The Environment RestaurantMartin de Keijzer
937 views50 slides
Introduction to PhoneGap and PhoneGap Build by
Introduction to PhoneGap and PhoneGap BuildIntroduction to PhoneGap and PhoneGap Build
Introduction to PhoneGap and PhoneGap BuildMartin de Keijzer
2.4K views64 slides
Hybrid Mobile Web Apps with Sencha Touch 2 by
Hybrid Mobile Web Apps with Sencha Touch 2Hybrid Mobile Web Apps with Sencha Touch 2
Hybrid Mobile Web Apps with Sencha Touch 2Martin de Keijzer
2.8K views70 slides

More from Martin de Keijzer(19)

High quality live broadcasting with PHP 27 07-2016 by Martin de Keijzer
High quality live broadcasting with PHP 27 07-2016High quality live broadcasting with PHP 27 07-2016
High quality live broadcasting with PHP 27 07-2016
Martin de Keijzer739 views
tiCONF Amsterdam 2014 building mobile teams by Martin de Keijzer
tiCONF Amsterdam 2014   building mobile teamstiCONF Amsterdam 2014   building mobile teams
tiCONF Amsterdam 2014 building mobile teams
Martin de Keijzer2.4K views
Introduction to PhoneGap and PhoneGap Build by Martin de Keijzer
Introduction to PhoneGap and PhoneGap BuildIntroduction to PhoneGap and PhoneGap Build
Introduction to PhoneGap and PhoneGap Build
Martin de Keijzer2.4K views
Hybrid Mobile Web Apps with Sencha Touch 2 by Martin de Keijzer
Hybrid Mobile Web Apps with Sencha Touch 2Hybrid Mobile Web Apps with Sencha Touch 2
Hybrid Mobile Web Apps with Sencha Touch 2
Martin de Keijzer2.8K views
2012 11-01 Hackers & founders - Boot to the web, boot 2 gecko / Firefox OS by Martin de Keijzer
2012 11-01 Hackers & founders - Boot to the web, boot 2 gecko / Firefox OS2012 11-01 Hackers & founders - Boot to the web, boot 2 gecko / Firefox OS
2012 11-01 Hackers & founders - Boot to the web, boot 2 gecko / Firefox OS
Martin de Keijzer1.5K views
2012 09-04 smart devcon - sencha touch 2 by Martin de Keijzer
2012 09-04 smart devcon - sencha touch 22012 09-04 smart devcon - sencha touch 2
2012 09-04 smart devcon - sencha touch 2
Martin de Keijzer834 views
2012 09-04 smart devcon - boot to the web, boot 2 gecko by Martin de Keijzer
2012 09-04 smart devcon - boot to the web, boot 2 gecko2012 09-04 smart devcon - boot to the web, boot 2 gecko
2012 09-04 smart devcon - boot to the web, boot 2 gecko
Martin de Keijzer888 views
Let's take over the world with Zend Framework by Martin de Keijzer
Let's take over the world with Zend FrameworkLet's take over the world with Zend Framework
Let's take over the world with Zend Framework
Martin de Keijzer1.9K views
Improving code quality with continuous integration (PHPBenelux Conference 2011) by Martin de Keijzer
Improving code quality with continuous integration (PHPBenelux Conference 2011)Improving code quality with continuous integration (PHPBenelux Conference 2011)
Improving code quality with continuous integration (PHPBenelux Conference 2011)
Martin de Keijzer4.7K views
Continuous integration why and how? [DPC uncon quick-prep version] by Martin de Keijzer
Continuous integration   why and how? [DPC uncon quick-prep version]Continuous integration   why and how? [DPC uncon quick-prep version]
Continuous integration why and how? [DPC uncon quick-prep version]
Martin de Keijzer743 views

Native Javascript apps with PhoneGap 11-04-2014 Codemotion Rome