SlideShare a Scribd company logo
1 of 35
Developing JavaScript Mobile Apps 
Using Apache Cordova 
Hazem Saleh
About Me 
• Ten years of experience in Java enterprise, portal, mobile 
solutions. 
• Apache Committer. 
• Author of four books. 
• DeveloperWorks Contributing author. 
• Technical Speaker. 
• Advisory Software Engineer in IBM.
Agenda 
Apache Cordova Introduction 
Configurations 
Cordova Command Line 
Hello World Demo 
Cordova APIs Overview 
jQuery Mobile Integration 
Memo Application Demo
Apache Cordova Introduction 
HTML CSS 
JS 
Platform
Apache Cordova Introduction 
Device native functions examples:
Apache Cordova Introduction 
Hybrid vs Native Application 
Hybrid Application 
(Cordova) 
Native Application 
Can be uploaded to App 
Store 
Yes yes 
Technology HTML + CSS + JavaScript Native platform 
Programming Language 
Cross-mobiles support Yes No 
Development Speed Faster Slower 
Uses Device Native 
Yes yes 
Features
Apache Cordova Introduction 
Cordova is supported on the following platforms:
Apache Cordova Introduction 
Challenges of the current mobile apps development: 
Many platforms and 
devices. 
Different skills needed. 
Different problem types. 
For Android: Java skills needed. 
For iOS: Objective-C (or SWIFT) 
skills needed. 
For Windows: C# skills needed. 
Huge Development and Testing Effort to 
have a single application on these platforms.
Apache Cordova Introduction 
Who can use Cordova? 
If you are a web developer and wants to develop a mobile 
application that can be deployed on the different app store 
portals. 
If you are a mobile native developer and wants to develop a 
single application on the different mobile platforms without 
having to re-implement the application code on every platform.
Agenda 
Apache Cordova Introduction 
Configurations 
Cordova Command Line 
Hello World Demo 
Cordova APIs Overview 
jQuery Mobile Integration 
Memo Application Demo
Configuration 
1 2 3 
Prerequisites: 
Node JS. 
Target SDK. 
From command line: 
> sudo npm install -g cordova 
To know the 
installed version of 
Cordova: 
> cordova -v
Agenda 
Apache Cordova Introduction 
Configurations 
Cordova Command Line 
Hello World Demo 
Cordova APIs Overview 
jQuery Mobile Integration 
Memo Application Demo
Cordova Command Line 
To create an application: 
> cordova create <<app_dir>> <<project_id>> <<app_title>> 
To add a platform (from the 
app folder): 
> cordova platform add <<platform_name>> 
To build Cordova project: 
> cordova build 
To deploy the app on 
emulator: 
> cordova emulate <<platform_name>>
Agenda 
Apache Cordova Introduction 
Configurations 
Cordova Command Line 
Hello World Demo 
Cordova APIs Overview 
jQuery Mobile Integration 
Memo Application Demo
Hello World Demo
Agenda 
Apache Cordova Introduction 
Configurations 
Cordova Command Line 
Hello World Demo 
Cordova APIs Overview 
jQuery Mobile Integration 
Memo Application Demo
Cordova APIs Overview 
Native device functions are represented as plugins that can be 
added and removed using the command line. 
Adding camera plugin 
example: 
> cordova plugin add https://git-wip-us. 
apache.org/repos/asf/cordova-plugin-camera.git 
Removing Camera plugin 
example: 
> cordova plugin rm org.apache.cordova.core.camera
Cordova APIs Overview 
Device 
An object that holds information about the device 
hardware and software. 
Device information is mainly about: 
 Device name. 
 Device Platform. 
 Device Platform version. 
 Device model. 
“deviceready” event is an indicator that Cordova finishes 
loading and Cordova APIs are ready to be called.
Cordova APIs Overview 
Camera 
An object that provides an access to the device camera. 
It can be used for: 
 Capturing a photo using the device’s Camera. 
 Picking a photo from the device’s gallery. 
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); 
}
Cordova APIs Overview 
Capture 
An object allows you recording audio, image, and video 
using the platform recording apps. 
// capture callback 
var captureSuccess = function(mediaFiles) { 
// Do something with the captured Audio media files 
}; 
var captureError = function(error) { 
navigator.notification.alert('Error code: ' + error.code, null, 
'Capture Error'); 
}; 
navigator.device.capture.captureAudio(captureSuccess, 
captureError, {limit:2});
Cordova APIs Overview 
Media 
An object that allows recording and playing back audio 
files on the device. 
var my_media = new Media("someFile.mp3", onSuccess, 
onError); 
my_media.play(); 
function onSuccess() { 
console.log("playAudio():Audio Success"); 
} 
function onError(error) { 
alert('code: ' + error.code + 'n' + 'message: ' + 
error.message + 'n'); 
}
Cordova APIs Overview 
Notification 
An object that displays visual, audible, and tactile 
notification. 
// Show a native looking alert 
navigator.notification.alert( 
'Cordova is great!', // message 
'Cordova', // title 
'Ok' // buttonName 
); 
// Beep four times 
navigator.notification.beep(4); 
// Vibrate for 3 seconds 
navigator.notification.vibrate(3000);
Cordova APIs Overview 
Storage 
Provides an access to the W3C Web Storage interface: 
- Local Storage (window.localStorage). 
- Session Storage (window.sessionStorage). 
window.localStorage.setItem("key", "value"); 
var value = window.localStorage.getItem("key"); 
window.localStorage.removeItem("key"); 
window.localStorage.clear();
Cordova APIs Overview 
Storage 
Provides an access to the device Web SQL Database 
(Full featured database). Cordova supports IndexedDB 
for WP8 and Blackberry 10. 
function populateDB(tx) { 
tx.executeSql('DROP TABLE IF EXISTS DEMO'); 
tx.executeSql('CREATE TABLE IF NOT EXISTS DEMO (id unique, data)'); 
tx.executeSql('INSERT INTO DEMO (id, data) VALUES (1, "First row")'); 
tx.executeSql('INSERT INTO DEMO (id, data) VALUES (2, "Second row")'); 
} 
function errorCB(err) { 
alert("Error processing SQL: " + err.code); 
} 
function successCB() { 
alert("success!"); 
} 
var db = window.openDatabase("Demos", "1.0", "Cordova Demo", 200000); 
db.transaction(populateDB, errorCB, successCB);
Cordova APIs Overview 
Geolocation 
Know your mobile location data (based on GPS sensor 
or inferred from Network signal). It is based on the W3C 
Geolocation API specification. 
var onSuccess = function(position) { 
alert('Latitude: ' + position.coords.latitude + 'n' + 
'Longitude: ' + position.coords.longitude + 'n'); 
}; 
function onError(error) { 
alert('code: ' + error.code + 'n' + 
'message: ' + error.message + 'n'); 
} 
navigator.geolocation.getCurrentPosition(onSuccess, onError);
Cordova APIs Overview 
More APIs: 
Events (In order to handle Apache Cordova life cycle 
events). 
Accelerometer (Capture device motion) 
Compass (Get the device direction) 
Connection (Get the device connection) 
Contacts (Access to device contacts database). 
File (Access to device File system based on W3C File 
API) 
Globalization (Access to user locale information)
Agenda 
Apache Cordova Introduction 
Configurations 
Cordova Command Line 
Hello World Demo 
Cordova APIs Overview 
jQuery Mobile Integration 
Memo Application Demo
jQuery Mobile Integration 
jQuery Mobile is: 
one of the most popular User Interface framework for building Mobile 
Web applications. 
uses HTML5 + CSS3 for layout pages with minimal scripting. 
compatible with most of the mobile and tablet browsers.
jQuery Mobile Integration 
Cordova does not restrict using any specific JavaScript library but using 
a JavaScript library will save you a lot of time creating your own 
widgets from scratch. 
jQuery Mobile is used in the demo application with Cordova to create 
the Memo utility. 
There are also many cool frameworks you can use in your Cordova 
mobile apps such as: 
Angular JS + lonic. Dojo mobile Sencha Touch.
jQuery Mobile Integration 
Windows Phone 8 Issues: 
Trimmed header title. 
Footer is not aligned to bottom. 
Fixes: 
Set ui-header and ui-title classes’ 
overflow to visible. 
Hide System Tray using app config 
(shell:SystemTray.isVisible = “False”).
jQuery Mobile Integration 
In order to boost the performance of jQuery mobile with 
Cordova, it is recommended to disable transition effects as 
follows: 
$.mobile.defaultPageTransition = 'none'; 
$.mobile.defaultDialogTransition = 'none’;
Agenda 
Apache Cordova Introduction 
Configurations 
Cordova Command Line 
Hello World Demo 
Cordova APIs Overview 
jQuery Mobile Integration 
Memo Application Demo
Memo Application 
GitHub URL: 
https://github.com/hazems/cordova-mega-app
JavaScript Quiz 
<script> 
var number = 50; 
var obj = { 
number: 60, 
getNum: function () { 
var number = 70; 
return this.number; 
} 
}; 
alert(obj.getNum()); 
alert(obj.getNum.call()); 
alert(obj.getNum.call({number:20})); 
</script>
Questions 
Twitter: @hazems 
Blog: http://www.technicaladvices.com 
Email: hazems@apache.org

More Related Content

What's hot

Titanium Studio [Updated - 18/12/2011]
Titanium Studio [Updated - 18/12/2011]Titanium Studio [Updated - 18/12/2011]
Titanium Studio [Updated - 18/12/2011]Sentinel Solutions Ltd
 
Project Presentation on Advance Java
Project Presentation on Advance JavaProject Presentation on Advance Java
Project Presentation on Advance JavaVikas Goyal
 
How React Native, Appium and me made each other shine @ContinuousDeliveryAmst...
How React Native, Appium and me made each other shine @ContinuousDeliveryAmst...How React Native, Appium and me made each other shine @ContinuousDeliveryAmst...
How React Native, Appium and me made each other shine @ContinuousDeliveryAmst...Wim Selles
 
Appium Meetup #2 - Mobile Web Automation Introduction
Appium Meetup #2 - Mobile Web Automation IntroductionAppium Meetup #2 - Mobile Web Automation Introduction
Appium Meetup #2 - Mobile Web Automation Introductionsnevesbarros
 
Building Mobile Friendly APIs in Rails
Building Mobile Friendly APIs in RailsBuilding Mobile Friendly APIs in Rails
Building Mobile Friendly APIs in RailsJim Jeffers
 
PhoneGap: Accessing Device Capabilities
PhoneGap: Accessing Device CapabilitiesPhoneGap: Accessing Device Capabilities
PhoneGap: Accessing Device CapabilitiesIvano Malavolta
 
How to generate a rest application - DevFest Vienna 2016
How to generate a rest application - DevFest Vienna 2016How to generate a rest application - DevFest Vienna 2016
How to generate a rest application - DevFest Vienna 2016johannes_fiala
 
108 advancedjava
108 advancedjava108 advancedjava
108 advancedjavaAnil Kumar
 
Getting started with appium
Getting started with appiumGetting started with appium
Getting started with appiumPratik Patel
 
Android & iOS Automation Using Appium
Android & iOS Automation Using AppiumAndroid & iOS Automation Using Appium
Android & iOS Automation Using AppiumMindfire Solutions
 
Java Intro: Unit1. Hello World
Java Intro: Unit1. Hello WorldJava Intro: Unit1. Hello World
Java Intro: Unit1. Hello WorldYakov Fain
 
Presentation - Course about JavaFX
Presentation - Course about JavaFXPresentation - Course about JavaFX
Presentation - Course about JavaFXTom Mix Petreca
 
Simplifying RCP Update and Install
Simplifying RCP Update and InstallSimplifying RCP Update and Install
Simplifying RCP Update and Installsusanfmccourt
 
Baruco 2014 - Rubymotion Workshop
Baruco 2014 - Rubymotion WorkshopBaruco 2014 - Rubymotion Workshop
Baruco 2014 - Rubymotion WorkshopBrian Sam-Bodden
 
SAP Kapsel Plugins For Cordova
SAP Kapsel Plugins For CordovaSAP Kapsel Plugins For Cordova
SAP Kapsel Plugins For CordovaChris Whealy
 
Appium basics
Appium basicsAppium basics
Appium basicsSyam Sasi
 
Hybrid application development
Hybrid application developmentHybrid application development
Hybrid application developmentEngin Hatay
 
[QE 2018] Adam Stasiak – Nadchodzi React Native – czyli o testowaniu mobilnyc...
[QE 2018] Adam Stasiak – Nadchodzi React Native – czyli o testowaniu mobilnyc...[QE 2018] Adam Stasiak – Nadchodzi React Native – czyli o testowaniu mobilnyc...
[QE 2018] Adam Stasiak – Nadchodzi React Native – czyli o testowaniu mobilnyc...Future Processing
 

What's hot (20)

Titanium Studio [Updated - 18/12/2011]
Titanium Studio [Updated - 18/12/2011]Titanium Studio [Updated - 18/12/2011]
Titanium Studio [Updated - 18/12/2011]
 
Project Presentation on Advance Java
Project Presentation on Advance JavaProject Presentation on Advance Java
Project Presentation on Advance Java
 
How React Native, Appium and me made each other shine @ContinuousDeliveryAmst...
How React Native, Appium and me made each other shine @ContinuousDeliveryAmst...How React Native, Appium and me made each other shine @ContinuousDeliveryAmst...
How React Native, Appium and me made each other shine @ContinuousDeliveryAmst...
 
Appium Meetup #2 - Mobile Web Automation Introduction
Appium Meetup #2 - Mobile Web Automation IntroductionAppium Meetup #2 - Mobile Web Automation Introduction
Appium Meetup #2 - Mobile Web Automation Introduction
 
Building Mobile Friendly APIs in Rails
Building Mobile Friendly APIs in RailsBuilding Mobile Friendly APIs in Rails
Building Mobile Friendly APIs in Rails
 
PhoneGap: Accessing Device Capabilities
PhoneGap: Accessing Device CapabilitiesPhoneGap: Accessing Device Capabilities
PhoneGap: Accessing Device Capabilities
 
How to generate a rest application - DevFest Vienna 2016
How to generate a rest application - DevFest Vienna 2016How to generate a rest application - DevFest Vienna 2016
How to generate a rest application - DevFest Vienna 2016
 
108 advancedjava
108 advancedjava108 advancedjava
108 advancedjava
 
Getting started with appium
Getting started with appiumGetting started with appium
Getting started with appium
 
Rcp by example
Rcp by exampleRcp by example
Rcp by example
 
Android & iOS Automation Using Appium
Android & iOS Automation Using AppiumAndroid & iOS Automation Using Appium
Android & iOS Automation Using Appium
 
Java Intro: Unit1. Hello World
Java Intro: Unit1. Hello WorldJava Intro: Unit1. Hello World
Java Intro: Unit1. Hello World
 
Presentation - Course about JavaFX
Presentation - Course about JavaFXPresentation - Course about JavaFX
Presentation - Course about JavaFX
 
Simplifying RCP Update and Install
Simplifying RCP Update and InstallSimplifying RCP Update and Install
Simplifying RCP Update and Install
 
Baruco 2014 - Rubymotion Workshop
Baruco 2014 - Rubymotion WorkshopBaruco 2014 - Rubymotion Workshop
Baruco 2014 - Rubymotion Workshop
 
SAP Kapsel Plugins For Cordova
SAP Kapsel Plugins For CordovaSAP Kapsel Plugins For Cordova
SAP Kapsel Plugins For Cordova
 
Appium basics
Appium basicsAppium basics
Appium basics
 
Android programming-basics
Android programming-basicsAndroid programming-basics
Android programming-basics
 
Hybrid application development
Hybrid application developmentHybrid application development
Hybrid application development
 
[QE 2018] Adam Stasiak – Nadchodzi React Native – czyli o testowaniu mobilnyc...
[QE 2018] Adam Stasiak – Nadchodzi React Native – czyli o testowaniu mobilnyc...[QE 2018] Adam Stasiak – Nadchodzi React Native – czyli o testowaniu mobilnyc...
[QE 2018] Adam Stasiak – Nadchodzi React Native – czyli o testowaniu mobilnyc...
 

Viewers also liked

App stores + cordova... get excited!
App stores + cordova... get excited!App stores + cordova... get excited!
App stores + cordova... get excited!Drake Emko
 
Codename one Cordova/PhoneGap Support
Codename one Cordova/PhoneGap SupportCodename one Cordova/PhoneGap Support
Codename one Cordova/PhoneGap SupportShai Almog
 
Introduction to Cordova
Introduction to CordovaIntroduction to Cordova
Introduction to CordovaRaymond Camden
 
Cross-platform mobile apps with Apache Cordova
Cross-platform mobile apps with Apache CordovaCross-platform mobile apps with Apache Cordova
Cross-platform mobile apps with Apache CordovaIvano Malavolta
 
Developing maintainable Cordova applications
Developing maintainable Cordova applicationsDeveloping maintainable Cordova applications
Developing maintainable Cordova applicationsIvano Malavolta
 
Cordova / PhoneGap, mobile apps development with HTML5/JS/CSS
Cordova / PhoneGap, mobile apps development with HTML5/JS/CSSCordova / PhoneGap, mobile apps development with HTML5/JS/CSS
Cordova / PhoneGap, mobile apps development with HTML5/JS/CSSGabriel Huecas
 
Cordova: APIs and instruments
Cordova: APIs and instrumentsCordova: APIs and instruments
Cordova: APIs and instrumentsIvano Malavolta
 
Phonegap/Cordova vs Native Application
Phonegap/Cordova vs Native ApplicationPhonegap/Cordova vs Native Application
Phonegap/Cordova vs Native ApplicationMuhammad Hakim A
 
WinJS, Apache Cordova & NFC - HTML5 apps for Android and Windows Phone
WinJS, Apache Cordova & NFC - HTML5 apps for Android and Windows PhoneWinJS, Apache Cordova & NFC - HTML5 apps for Android and Windows Phone
WinJS, Apache Cordova & NFC - HTML5 apps for Android and Windows PhoneAndreas Jakl
 
Hybrid Mobile App Development With Cordova
Hybrid Mobile App Development With CordovaHybrid Mobile App Development With Cordova
Hybrid Mobile App Development With CordovaLohith Goudagere Nagaraj
 

Viewers also liked (10)

App stores + cordova... get excited!
App stores + cordova... get excited!App stores + cordova... get excited!
App stores + cordova... get excited!
 
Codename one Cordova/PhoneGap Support
Codename one Cordova/PhoneGap SupportCodename one Cordova/PhoneGap Support
Codename one Cordova/PhoneGap Support
 
Introduction to Cordova
Introduction to CordovaIntroduction to Cordova
Introduction to Cordova
 
Cross-platform mobile apps with Apache Cordova
Cross-platform mobile apps with Apache CordovaCross-platform mobile apps with Apache Cordova
Cross-platform mobile apps with Apache Cordova
 
Developing maintainable Cordova applications
Developing maintainable Cordova applicationsDeveloping maintainable Cordova applications
Developing maintainable Cordova applications
 
Cordova / PhoneGap, mobile apps development with HTML5/JS/CSS
Cordova / PhoneGap, mobile apps development with HTML5/JS/CSSCordova / PhoneGap, mobile apps development with HTML5/JS/CSS
Cordova / PhoneGap, mobile apps development with HTML5/JS/CSS
 
Cordova: APIs and instruments
Cordova: APIs and instrumentsCordova: APIs and instruments
Cordova: APIs and instruments
 
Phonegap/Cordova vs Native Application
Phonegap/Cordova vs Native ApplicationPhonegap/Cordova vs Native Application
Phonegap/Cordova vs Native Application
 
WinJS, Apache Cordova & NFC - HTML5 apps for Android and Windows Phone
WinJS, Apache Cordova & NFC - HTML5 apps for Android and Windows PhoneWinJS, Apache Cordova & NFC - HTML5 apps for Android and Windows Phone
WinJS, Apache Cordova & NFC - HTML5 apps for Android and Windows Phone
 
Hybrid Mobile App Development With Cordova
Hybrid Mobile App Development With CordovaHybrid Mobile App Development With Cordova
Hybrid Mobile App Development With Cordova
 

Similar to [JMaghreb 2014] Developing JavaScript Mobile Apps Using Apache Cordova

Introduction to Apache Cordova (Phonegap)
Introduction to Apache Cordova (Phonegap)Introduction to Apache Cordova (Phonegap)
Introduction to Apache Cordova (Phonegap)ejlp12
 
Ionic Framework - get up and running to build hybrid mobile apps
Ionic Framework - get up and running to build hybrid mobile appsIonic Framework - get up and running to build hybrid mobile apps
Ionic Framework - get up and running to build hybrid mobile appsAndreas Sahle
 
Phonegap android
Phonegap androidPhonegap android
Phonegap androidumesh patil
 
Angularjs Tutorial for Beginners
Angularjs Tutorial for BeginnersAngularjs Tutorial for Beginners
Angularjs Tutorial for Beginnersrajkamaltibacademy
 
Android App Development using HTML5 Technology
Android App Development using HTML5 TechnologyAndroid App Development using HTML5 Technology
Android App Development using HTML5 TechnologyOon Arfiandwi
 
Cross Platform Mobile Apps with the Ionic Framework
Cross Platform Mobile Apps with the Ionic FrameworkCross Platform Mobile Apps with the Ionic Framework
Cross Platform Mobile Apps with the Ionic FrameworkTroy Miles
 
Building Cross-Platform Mobile Apps
Building Cross-Platform Mobile AppsBuilding Cross-Platform Mobile Apps
Building Cross-Platform Mobile AppsTroy Miles
 
HTML alchemy: the secrets of mixing JavaScript and Java EE - Matthias Wessendorf
HTML alchemy: the secrets of mixing JavaScript and Java EE - Matthias WessendorfHTML alchemy: the secrets of mixing JavaScript and Java EE - Matthias Wessendorf
HTML alchemy: the secrets of mixing JavaScript and Java EE - Matthias WessendorfJAX London
 
Tutorial: Develop Mobile Applications with AngularJS
Tutorial: Develop Mobile Applications with AngularJSTutorial: Develop Mobile Applications with AngularJS
Tutorial: Develop Mobile Applications with AngularJSPhilipp Burgmer
 
phonegap with angular js for freshers
phonegap with angular js for freshers    phonegap with angular js for freshers
phonegap with angular js for freshers dssprakash
 
Telerik AppBuilder Presentation for TelerikNEXT Conference
Telerik AppBuilder Presentation for TelerikNEXT ConferenceTelerik AppBuilder Presentation for TelerikNEXT Conference
Telerik AppBuilder Presentation for TelerikNEXT ConferenceJen Looper
 
Electron - cross platform desktop applications made easy
Electron - cross platform desktop applications made easyElectron - cross platform desktop applications made easy
Electron - cross platform desktop applications made easyUlrich Krause
 
Web APIs & Apps - Mozilla
Web APIs & Apps - MozillaWeb APIs & Apps - Mozilla
Web APIs & Apps - MozillaRobert Nyman
 
Developing Java Web Applications
Developing Java Web ApplicationsDeveloping Java Web Applications
Developing Java Web Applicationshchen1
 
WebAPIs & Apps - Mozilla London
WebAPIs & Apps - Mozilla LondonWebAPIs & Apps - Mozilla London
WebAPIs & Apps - Mozilla LondonRobert Nyman
 
Fixing the mobile web - Internet World Romania
Fixing the mobile web - Internet World RomaniaFixing the mobile web - Internet World Romania
Fixing the mobile web - Internet World RomaniaChristian Heilmann
 
Cross Platform Mobile Apps with the Ionic Framework
Cross Platform Mobile Apps with the Ionic FrameworkCross Platform Mobile Apps with the Ionic Framework
Cross Platform Mobile Apps with the Ionic FrameworkTroy Miles
 

Similar to [JMaghreb 2014] Developing JavaScript Mobile Apps Using Apache Cordova (20)

Introduction to Apache Cordova (Phonegap)
Introduction to Apache Cordova (Phonegap)Introduction to Apache Cordova (Phonegap)
Introduction to Apache Cordova (Phonegap)
 
Ionic Framework - get up and running to build hybrid mobile apps
Ionic Framework - get up and running to build hybrid mobile appsIonic Framework - get up and running to build hybrid mobile apps
Ionic Framework - get up and running to build hybrid mobile apps
 
iOS App Using cordova
iOS App Using cordovaiOS App Using cordova
iOS App Using cordova
 
Phonegap android
Phonegap androidPhonegap android
Phonegap android
 
Angularjs Tutorial for Beginners
Angularjs Tutorial for BeginnersAngularjs Tutorial for Beginners
Angularjs Tutorial for Beginners
 
Android App Development using HTML5 Technology
Android App Development using HTML5 TechnologyAndroid App Development using HTML5 Technology
Android App Development using HTML5 Technology
 
Cross Platform Mobile Apps with the Ionic Framework
Cross Platform Mobile Apps with the Ionic FrameworkCross Platform Mobile Apps with the Ionic Framework
Cross Platform Mobile Apps with the Ionic Framework
 
Building Cross-Platform Mobile Apps
Building Cross-Platform Mobile AppsBuilding Cross-Platform Mobile Apps
Building Cross-Platform Mobile Apps
 
HTML alchemy: the secrets of mixing JavaScript and Java EE - Matthias Wessendorf
HTML alchemy: the secrets of mixing JavaScript and Java EE - Matthias WessendorfHTML alchemy: the secrets of mixing JavaScript and Java EE - Matthias Wessendorf
HTML alchemy: the secrets of mixing JavaScript and Java EE - Matthias Wessendorf
 
Tutorial: Develop Mobile Applications with AngularJS
Tutorial: Develop Mobile Applications with AngularJSTutorial: Develop Mobile Applications with AngularJS
Tutorial: Develop Mobile Applications with AngularJS
 
phonegap with angular js for freshers
phonegap with angular js for freshers    phonegap with angular js for freshers
phonegap with angular js for freshers
 
Android CI and Appium
Android CI and AppiumAndroid CI and Appium
Android CI and Appium
 
Telerik AppBuilder Presentation for TelerikNEXT Conference
Telerik AppBuilder Presentation for TelerikNEXT ConferenceTelerik AppBuilder Presentation for TelerikNEXT Conference
Telerik AppBuilder Presentation for TelerikNEXT Conference
 
Electron - cross platform desktop applications made easy
Electron - cross platform desktop applications made easyElectron - cross platform desktop applications made easy
Electron - cross platform desktop applications made easy
 
Web APIs & Apps - Mozilla
Web APIs & Apps - MozillaWeb APIs & Apps - Mozilla
Web APIs & Apps - Mozilla
 
Developing Java Web Applications
Developing Java Web ApplicationsDeveloping Java Web Applications
Developing Java Web Applications
 
WebAPIs & Apps - Mozilla London
WebAPIs & Apps - Mozilla LondonWebAPIs & Apps - Mozilla London
WebAPIs & Apps - Mozilla London
 
Fixing the mobile web - Internet World Romania
Fixing the mobile web - Internet World RomaniaFixing the mobile web - Internet World Romania
Fixing the mobile web - Internet World Romania
 
Cross Platform Mobile Apps with the Ionic Framework
Cross Platform Mobile Apps with the Ionic FrameworkCross Platform Mobile Apps with the Ionic Framework
Cross Platform Mobile Apps with the Ionic Framework
 
HTML5 WebWorks
HTML5 WebWorksHTML5 WebWorks
HTML5 WebWorks
 

More from Hazem Saleh

[FullStack NYC 2019] Effective Unit Tests for JavaScript
[FullStack NYC 2019] Effective Unit Tests for JavaScript[FullStack NYC 2019] Effective Unit Tests for JavaScript
[FullStack NYC 2019] Effective Unit Tests for JavaScriptHazem Saleh
 
Mockito 2.x Migration - Droidcon UK 2018
Mockito 2.x Migration - Droidcon UK 2018Mockito 2.x Migration - Droidcon UK 2018
Mockito 2.x Migration - Droidcon UK 2018Hazem Saleh
 
JavaScript Unit Testing with an Angular 5.x Use Case 101
JavaScript Unit Testing with an Angular 5.x Use Case 101JavaScript Unit Testing with an Angular 5.x Use Case 101
JavaScript Unit Testing with an Angular 5.x Use Case 101Hazem Saleh
 
Dojo >= 1.7 Kickstart
Dojo >= 1.7  KickstartDojo >= 1.7  Kickstart
Dojo >= 1.7 KickstartHazem Saleh
 
Efficient JavaScript Unit Testing (Chinese Version), JavaOne China 2013
Efficient JavaScript Unit Testing (Chinese Version), JavaOne China 2013Efficient JavaScript Unit Testing (Chinese Version), JavaOne China 2013
Efficient JavaScript Unit Testing (Chinese Version), JavaOne China 2013Hazem Saleh
 
JSF Mashups in Action
JSF Mashups in ActionJSF Mashups in Action
JSF Mashups in ActionHazem Saleh
 
Efficient JavaScript Unit Testing, March 2013
Efficient JavaScript Unit Testing, March 2013Efficient JavaScript Unit Testing, March 2013
Efficient JavaScript Unit Testing, March 2013Hazem Saleh
 
JavaScript tools
JavaScript toolsJavaScript tools
JavaScript toolsHazem Saleh
 
Efficient JavaScript Unit Testing, May 2012
Efficient JavaScript Unit Testing, May 2012Efficient JavaScript Unit Testing, May 2012
Efficient JavaScript Unit Testing, May 2012Hazem Saleh
 
[JavaOne 2010] Abstract Mashups for Enterprise Java
[JavaOne 2010] Abstract Mashups for Enterprise Java[JavaOne 2010] Abstract Mashups for Enterprise Java
[JavaOne 2010] Abstract Mashups for Enterprise JavaHazem Saleh
 

More from Hazem Saleh (11)

[FullStack NYC 2019] Effective Unit Tests for JavaScript
[FullStack NYC 2019] Effective Unit Tests for JavaScript[FullStack NYC 2019] Effective Unit Tests for JavaScript
[FullStack NYC 2019] Effective Unit Tests for JavaScript
 
Mockito 2.x Migration - Droidcon UK 2018
Mockito 2.x Migration - Droidcon UK 2018Mockito 2.x Migration - Droidcon UK 2018
Mockito 2.x Migration - Droidcon UK 2018
 
JavaScript Unit Testing with an Angular 5.x Use Case 101
JavaScript Unit Testing with an Angular 5.x Use Case 101JavaScript Unit Testing with an Angular 5.x Use Case 101
JavaScript Unit Testing with an Angular 5.x Use Case 101
 
Dojo >= 1.7 Kickstart
Dojo >= 1.7  KickstartDojo >= 1.7  Kickstart
Dojo >= 1.7 Kickstart
 
Efficient JavaScript Unit Testing (Chinese Version), JavaOne China 2013
Efficient JavaScript Unit Testing (Chinese Version), JavaOne China 2013Efficient JavaScript Unit Testing (Chinese Version), JavaOne China 2013
Efficient JavaScript Unit Testing (Chinese Version), JavaOne China 2013
 
JSF Mashups in Action
JSF Mashups in ActionJSF Mashups in Action
JSF Mashups in Action
 
Efficient JavaScript Unit Testing, March 2013
Efficient JavaScript Unit Testing, March 2013Efficient JavaScript Unit Testing, March 2013
Efficient JavaScript Unit Testing, March 2013
 
JavaScript tools
JavaScript toolsJavaScript tools
JavaScript tools
 
Efficient JavaScript Unit Testing, May 2012
Efficient JavaScript Unit Testing, May 2012Efficient JavaScript Unit Testing, May 2012
Efficient JavaScript Unit Testing, May 2012
 
[JavaOne 2010] Abstract Mashups for Enterprise Java
[JavaOne 2010] Abstract Mashups for Enterprise Java[JavaOne 2010] Abstract Mashups for Enterprise Java
[JavaOne 2010] Abstract Mashups for Enterprise Java
 
GMaps4JSF
GMaps4JSFGMaps4JSF
GMaps4JSF
 

Recently uploaded

Science 7 Quarter 4 Module 2: Natural Resources.pptx
Science 7 Quarter 4 Module 2: Natural Resources.pptxScience 7 Quarter 4 Module 2: Natural Resources.pptx
Science 7 Quarter 4 Module 2: Natural Resources.pptxMaryGraceBautista27
 
Barangay Council for the Protection of Children (BCPC) Orientation.pptx
Barangay Council for the Protection of Children (BCPC) Orientation.pptxBarangay Council for the Protection of Children (BCPC) Orientation.pptx
Barangay Council for the Protection of Children (BCPC) Orientation.pptxCarlos105
 
Student Profile Sample - We help schools to connect the data they have, with ...
Student Profile Sample - We help schools to connect the data they have, with ...Student Profile Sample - We help schools to connect the data they have, with ...
Student Profile Sample - We help schools to connect the data they have, with ...Seán Kennedy
 
Field Attribute Index Feature in Odoo 17
Field Attribute Index Feature in Odoo 17Field Attribute Index Feature in Odoo 17
Field Attribute Index Feature in Odoo 17Celine George
 
AMERICAN LANGUAGE HUB_Level2_Student'sBook_Answerkey.pdf
AMERICAN LANGUAGE HUB_Level2_Student'sBook_Answerkey.pdfAMERICAN LANGUAGE HUB_Level2_Student'sBook_Answerkey.pdf
AMERICAN LANGUAGE HUB_Level2_Student'sBook_Answerkey.pdfphamnguyenenglishnb
 
MULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptx
MULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptxMULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptx
MULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptxAnupkumar Sharma
 
Transaction Management in Database Management System
Transaction Management in Database Management SystemTransaction Management in Database Management System
Transaction Management in Database Management SystemChristalin Nelson
 
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptxECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptxiammrhaywood
 
What is Model Inheritance in Odoo 17 ERP
What is Model Inheritance in Odoo 17 ERPWhat is Model Inheritance in Odoo 17 ERP
What is Model Inheritance in Odoo 17 ERPCeline George
 
USPS® Forced Meter Migration - How to Know if Your Postage Meter Will Soon be...
USPS® Forced Meter Migration - How to Know if Your Postage Meter Will Soon be...USPS® Forced Meter Migration - How to Know if Your Postage Meter Will Soon be...
USPS® Forced Meter Migration - How to Know if Your Postage Meter Will Soon be...Postal Advocate Inc.
 
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️9953056974 Low Rate Call Girls In Saket, Delhi NCR
 
Virtual-Orientation-on-the-Administration-of-NATG12-NATG6-and-ELLNA.pdf
Virtual-Orientation-on-the-Administration-of-NATG12-NATG6-and-ELLNA.pdfVirtual-Orientation-on-the-Administration-of-NATG12-NATG6-and-ELLNA.pdf
Virtual-Orientation-on-the-Administration-of-NATG12-NATG6-and-ELLNA.pdfErwinPantujan2
 
Concurrency Control in Database Management system
Concurrency Control in Database Management systemConcurrency Control in Database Management system
Concurrency Control in Database Management systemChristalin Nelson
 
Like-prefer-love -hate+verb+ing & silent letters & citizenship text.pdf
Like-prefer-love -hate+verb+ing & silent letters & citizenship text.pdfLike-prefer-love -hate+verb+ing & silent letters & citizenship text.pdf
Like-prefer-love -hate+verb+ing & silent letters & citizenship text.pdfMr Bounab Samir
 
THEORIES OF ORGANIZATION-PUBLIC ADMINISTRATION
THEORIES OF ORGANIZATION-PUBLIC ADMINISTRATIONTHEORIES OF ORGANIZATION-PUBLIC ADMINISTRATION
THEORIES OF ORGANIZATION-PUBLIC ADMINISTRATIONHumphrey A Beña
 
Proudly South Africa powerpoint Thorisha.pptx
Proudly South Africa powerpoint Thorisha.pptxProudly South Africa powerpoint Thorisha.pptx
Proudly South Africa powerpoint Thorisha.pptxthorishapillay1
 
4.18.24 Movement Legacies, Reflection, and Review.pptx
4.18.24 Movement Legacies, Reflection, and Review.pptx4.18.24 Movement Legacies, Reflection, and Review.pptx
4.18.24 Movement Legacies, Reflection, and Review.pptxmary850239
 
ENGLISH6-Q4-W3.pptxqurter our high choom
ENGLISH6-Q4-W3.pptxqurter our high choomENGLISH6-Q4-W3.pptxqurter our high choom
ENGLISH6-Q4-W3.pptxqurter our high choomnelietumpap1
 
Keynote by Prof. Wurzer at Nordex about IP-design
Keynote by Prof. Wurzer at Nordex about IP-designKeynote by Prof. Wurzer at Nordex about IP-design
Keynote by Prof. Wurzer at Nordex about IP-designMIPLM
 

Recently uploaded (20)

Science 7 Quarter 4 Module 2: Natural Resources.pptx
Science 7 Quarter 4 Module 2: Natural Resources.pptxScience 7 Quarter 4 Module 2: Natural Resources.pptx
Science 7 Quarter 4 Module 2: Natural Resources.pptx
 
Barangay Council for the Protection of Children (BCPC) Orientation.pptx
Barangay Council for the Protection of Children (BCPC) Orientation.pptxBarangay Council for the Protection of Children (BCPC) Orientation.pptx
Barangay Council for the Protection of Children (BCPC) Orientation.pptx
 
YOUVE GOT EMAIL_FINALS_EL_DORADO_2024.pptx
YOUVE GOT EMAIL_FINALS_EL_DORADO_2024.pptxYOUVE GOT EMAIL_FINALS_EL_DORADO_2024.pptx
YOUVE GOT EMAIL_FINALS_EL_DORADO_2024.pptx
 
Student Profile Sample - We help schools to connect the data they have, with ...
Student Profile Sample - We help schools to connect the data they have, with ...Student Profile Sample - We help schools to connect the data they have, with ...
Student Profile Sample - We help schools to connect the data they have, with ...
 
Field Attribute Index Feature in Odoo 17
Field Attribute Index Feature in Odoo 17Field Attribute Index Feature in Odoo 17
Field Attribute Index Feature in Odoo 17
 
AMERICAN LANGUAGE HUB_Level2_Student'sBook_Answerkey.pdf
AMERICAN LANGUAGE HUB_Level2_Student'sBook_Answerkey.pdfAMERICAN LANGUAGE HUB_Level2_Student'sBook_Answerkey.pdf
AMERICAN LANGUAGE HUB_Level2_Student'sBook_Answerkey.pdf
 
MULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptx
MULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptxMULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptx
MULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptx
 
Transaction Management in Database Management System
Transaction Management in Database Management SystemTransaction Management in Database Management System
Transaction Management in Database Management System
 
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptxECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
 
What is Model Inheritance in Odoo 17 ERP
What is Model Inheritance in Odoo 17 ERPWhat is Model Inheritance in Odoo 17 ERP
What is Model Inheritance in Odoo 17 ERP
 
USPS® Forced Meter Migration - How to Know if Your Postage Meter Will Soon be...
USPS® Forced Meter Migration - How to Know if Your Postage Meter Will Soon be...USPS® Forced Meter Migration - How to Know if Your Postage Meter Will Soon be...
USPS® Forced Meter Migration - How to Know if Your Postage Meter Will Soon be...
 
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
 
Virtual-Orientation-on-the-Administration-of-NATG12-NATG6-and-ELLNA.pdf
Virtual-Orientation-on-the-Administration-of-NATG12-NATG6-and-ELLNA.pdfVirtual-Orientation-on-the-Administration-of-NATG12-NATG6-and-ELLNA.pdf
Virtual-Orientation-on-the-Administration-of-NATG12-NATG6-and-ELLNA.pdf
 
Concurrency Control in Database Management system
Concurrency Control in Database Management systemConcurrency Control in Database Management system
Concurrency Control in Database Management system
 
Like-prefer-love -hate+verb+ing & silent letters & citizenship text.pdf
Like-prefer-love -hate+verb+ing & silent letters & citizenship text.pdfLike-prefer-love -hate+verb+ing & silent letters & citizenship text.pdf
Like-prefer-love -hate+verb+ing & silent letters & citizenship text.pdf
 
THEORIES OF ORGANIZATION-PUBLIC ADMINISTRATION
THEORIES OF ORGANIZATION-PUBLIC ADMINISTRATIONTHEORIES OF ORGANIZATION-PUBLIC ADMINISTRATION
THEORIES OF ORGANIZATION-PUBLIC ADMINISTRATION
 
Proudly South Africa powerpoint Thorisha.pptx
Proudly South Africa powerpoint Thorisha.pptxProudly South Africa powerpoint Thorisha.pptx
Proudly South Africa powerpoint Thorisha.pptx
 
4.18.24 Movement Legacies, Reflection, and Review.pptx
4.18.24 Movement Legacies, Reflection, and Review.pptx4.18.24 Movement Legacies, Reflection, and Review.pptx
4.18.24 Movement Legacies, Reflection, and Review.pptx
 
ENGLISH6-Q4-W3.pptxqurter our high choom
ENGLISH6-Q4-W3.pptxqurter our high choomENGLISH6-Q4-W3.pptxqurter our high choom
ENGLISH6-Q4-W3.pptxqurter our high choom
 
Keynote by Prof. Wurzer at Nordex about IP-design
Keynote by Prof. Wurzer at Nordex about IP-designKeynote by Prof. Wurzer at Nordex about IP-design
Keynote by Prof. Wurzer at Nordex about IP-design
 

[JMaghreb 2014] Developing JavaScript Mobile Apps Using Apache Cordova

  • 1. Developing JavaScript Mobile Apps Using Apache Cordova Hazem Saleh
  • 2. About Me • Ten years of experience in Java enterprise, portal, mobile solutions. • Apache Committer. • Author of four books. • DeveloperWorks Contributing author. • Technical Speaker. • Advisory Software Engineer in IBM.
  • 3. Agenda Apache Cordova Introduction Configurations Cordova Command Line Hello World Demo Cordova APIs Overview jQuery Mobile Integration Memo Application Demo
  • 4. Apache Cordova Introduction HTML CSS JS Platform
  • 5. Apache Cordova Introduction Device native functions examples:
  • 6. Apache Cordova Introduction Hybrid vs Native Application Hybrid Application (Cordova) Native Application Can be uploaded to App Store Yes yes Technology HTML + CSS + JavaScript Native platform Programming Language Cross-mobiles support Yes No Development Speed Faster Slower Uses Device Native Yes yes Features
  • 7. Apache Cordova Introduction Cordova is supported on the following platforms:
  • 8. Apache Cordova Introduction Challenges of the current mobile apps development: Many platforms and devices. Different skills needed. Different problem types. For Android: Java skills needed. For iOS: Objective-C (or SWIFT) skills needed. For Windows: C# skills needed. Huge Development and Testing Effort to have a single application on these platforms.
  • 9. Apache Cordova Introduction Who can use Cordova? If you are a web developer and wants to develop a mobile application that can be deployed on the different app store portals. If you are a mobile native developer and wants to develop a single application on the different mobile platforms without having to re-implement the application code on every platform.
  • 10. Agenda Apache Cordova Introduction Configurations Cordova Command Line Hello World Demo Cordova APIs Overview jQuery Mobile Integration Memo Application Demo
  • 11. Configuration 1 2 3 Prerequisites: Node JS. Target SDK. From command line: > sudo npm install -g cordova To know the installed version of Cordova: > cordova -v
  • 12. Agenda Apache Cordova Introduction Configurations Cordova Command Line Hello World Demo Cordova APIs Overview jQuery Mobile Integration Memo Application Demo
  • 13. Cordova Command Line To create an application: > cordova create <<app_dir>> <<project_id>> <<app_title>> To add a platform (from the app folder): > cordova platform add <<platform_name>> To build Cordova project: > cordova build To deploy the app on emulator: > cordova emulate <<platform_name>>
  • 14. Agenda Apache Cordova Introduction Configurations Cordova Command Line Hello World Demo Cordova APIs Overview jQuery Mobile Integration Memo Application Demo
  • 16. Agenda Apache Cordova Introduction Configurations Cordova Command Line Hello World Demo Cordova APIs Overview jQuery Mobile Integration Memo Application Demo
  • 17. Cordova APIs Overview Native device functions are represented as plugins that can be added and removed using the command line. Adding camera plugin example: > cordova plugin add https://git-wip-us. apache.org/repos/asf/cordova-plugin-camera.git Removing Camera plugin example: > cordova plugin rm org.apache.cordova.core.camera
  • 18. Cordova APIs Overview Device An object that holds information about the device hardware and software. Device information is mainly about:  Device name.  Device Platform.  Device Platform version.  Device model. “deviceready” event is an indicator that Cordova finishes loading and Cordova APIs are ready to be called.
  • 19. Cordova APIs Overview Camera An object that provides an access to the device camera. It can be used for:  Capturing a photo using the device’s Camera.  Picking a photo from the device’s gallery. 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); }
  • 20. Cordova APIs Overview Capture An object allows you recording audio, image, and video using the platform recording apps. // capture callback var captureSuccess = function(mediaFiles) { // Do something with the captured Audio media files }; var captureError = function(error) { navigator.notification.alert('Error code: ' + error.code, null, 'Capture Error'); }; navigator.device.capture.captureAudio(captureSuccess, captureError, {limit:2});
  • 21. Cordova APIs Overview Media An object that allows recording and playing back audio files on the device. var my_media = new Media("someFile.mp3", onSuccess, onError); my_media.play(); function onSuccess() { console.log("playAudio():Audio Success"); } function onError(error) { alert('code: ' + error.code + 'n' + 'message: ' + error.message + 'n'); }
  • 22. Cordova APIs Overview Notification An object that displays visual, audible, and tactile notification. // Show a native looking alert navigator.notification.alert( 'Cordova is great!', // message 'Cordova', // title 'Ok' // buttonName ); // Beep four times navigator.notification.beep(4); // Vibrate for 3 seconds navigator.notification.vibrate(3000);
  • 23. Cordova APIs Overview Storage Provides an access to the W3C Web Storage interface: - Local Storage (window.localStorage). - Session Storage (window.sessionStorage). window.localStorage.setItem("key", "value"); var value = window.localStorage.getItem("key"); window.localStorage.removeItem("key"); window.localStorage.clear();
  • 24. Cordova APIs Overview Storage Provides an access to the device Web SQL Database (Full featured database). Cordova supports IndexedDB for WP8 and Blackberry 10. function populateDB(tx) { tx.executeSql('DROP TABLE IF EXISTS DEMO'); tx.executeSql('CREATE TABLE IF NOT EXISTS DEMO (id unique, data)'); tx.executeSql('INSERT INTO DEMO (id, data) VALUES (1, "First row")'); tx.executeSql('INSERT INTO DEMO (id, data) VALUES (2, "Second row")'); } function errorCB(err) { alert("Error processing SQL: " + err.code); } function successCB() { alert("success!"); } var db = window.openDatabase("Demos", "1.0", "Cordova Demo", 200000); db.transaction(populateDB, errorCB, successCB);
  • 25. Cordova APIs Overview Geolocation Know your mobile location data (based on GPS sensor or inferred from Network signal). It is based on the W3C Geolocation API specification. var onSuccess = function(position) { alert('Latitude: ' + position.coords.latitude + 'n' + 'Longitude: ' + position.coords.longitude + 'n'); }; function onError(error) { alert('code: ' + error.code + 'n' + 'message: ' + error.message + 'n'); } navigator.geolocation.getCurrentPosition(onSuccess, onError);
  • 26. Cordova APIs Overview More APIs: Events (In order to handle Apache Cordova life cycle events). Accelerometer (Capture device motion) Compass (Get the device direction) Connection (Get the device connection) Contacts (Access to device contacts database). File (Access to device File system based on W3C File API) Globalization (Access to user locale information)
  • 27. Agenda Apache Cordova Introduction Configurations Cordova Command Line Hello World Demo Cordova APIs Overview jQuery Mobile Integration Memo Application Demo
  • 28. jQuery Mobile Integration jQuery Mobile is: one of the most popular User Interface framework for building Mobile Web applications. uses HTML5 + CSS3 for layout pages with minimal scripting. compatible with most of the mobile and tablet browsers.
  • 29. jQuery Mobile Integration Cordova does not restrict using any specific JavaScript library but using a JavaScript library will save you a lot of time creating your own widgets from scratch. jQuery Mobile is used in the demo application with Cordova to create the Memo utility. There are also many cool frameworks you can use in your Cordova mobile apps such as: Angular JS + lonic. Dojo mobile Sencha Touch.
  • 30. jQuery Mobile Integration Windows Phone 8 Issues: Trimmed header title. Footer is not aligned to bottom. Fixes: Set ui-header and ui-title classes’ overflow to visible. Hide System Tray using app config (shell:SystemTray.isVisible = “False”).
  • 31. jQuery Mobile Integration In order to boost the performance of jQuery mobile with Cordova, it is recommended to disable transition effects as follows: $.mobile.defaultPageTransition = 'none'; $.mobile.defaultDialogTransition = 'none’;
  • 32. Agenda Apache Cordova Introduction Configurations Cordova Command Line Hello World Demo Cordova APIs Overview jQuery Mobile Integration Memo Application Demo
  • 33. Memo Application GitHub URL: https://github.com/hazems/cordova-mega-app
  • 34. JavaScript Quiz <script> var number = 50; var obj = { number: 60, getNum: function () { var number = 70; return this.number; } }; alert(obj.getNum()); alert(obj.getNum.call()); alert(obj.getNum.call({number:20})); </script>
  • 35. Questions Twitter: @hazems Blog: http://www.technicaladvices.com Email: hazems@apache.org

Editor's Notes

  1. Hello and Welcome everybody. I’m Hazem Saleh, an advisory engineer in IBM and an Apache Committer. Today, I will talk about “Developing JavaScript Mobile Apps Using Apache Cordova”.
  2. Before going into the details of this presentation. I would like to introduce myself in more details …
  3. So, today, We will: Have an introduction about Apache Cordova, we will know: What Apache Cordova is, The differences between mobile web vs Hybrid vs native mobile applications, the current challenges of today’s mobile development and how Apache Cordova can minimize these challenges. We will know how to configure Apache Cordova. We will see how to work with Cordova Command Line Interface in order to create and build a cordova project. Then I will show you how to create and deploy an Apache Cordova application from scratch using CLI. Then we will have an overview of Apache Cordova APIs. And we will explore the jQuery mobile Integration tips with Apache Cordova. Finally, I will show you a real application that supports three mobile platforms (iOS, Android and Windows Phone 8). This application utilizes the device’s audio and camera in order to create a memo utility.
  4. So What is Apache Cordova is a set of APIs which allow accessing the device native functions using JavaScript. Apache Cordova is not only a set of APIs but it also a platform which allows creating mobile apps using common web technologies (HTML, CSS, JavaScript).
  5. Device native function examples are: Accessing the device audio to record and playback voice. Capturing a photo using the device camera. Searching and adding contacts to the device. Accessing the device compass and file system.
  6. Before going into the details of the current mobile apps development, it is important to realize the differences between mobile web apps, hybrid mobile apps, and native mobile apps. Mobile web apps: Are mobile-friendly apps which are displayed correctly on the different resolutions of mobile devices and tablets. Usually require you to be online in order to access it as they are not installed locally in your device. Have limited access to the device native functions by utilizing the HTML 5 APIs such as Geolocation. For Hybrid and native mobile apps: They have the same physical format and they can be uploaded to the app store. However, they uses two different technologies. For Hybrid mobile apps, they uses HTML, CSS and JavaScript while Native mobile apps use the native programming language of the mobile platform. Hybrid mobile apps can work on the different mobile platforms while Native mobile apps work only on the platform they are developed for. …
  7. We have the following Challenges in the current mobile application development: We have many platforms. Every platform has many devices. This means that testing your application cross these devices is a real overhead. In order to develop an application cross the different mobile platforms, we need to have different skills in the team. For Android, we need the development team to know Java, for … Because every platform has its own philosophy, we can find different problem types on every mobile platform. For example, sending SMS in Android (and continue the example). Handling these problem types using different programming languages is not an easy task. All of this leads to a huge development and testing effort to have a single application idea developed on these mobile platforms. Apache Cordova could meet these challenges by providing a single programming language to develop cross-mobile platform apps which is JavaScript. This means that you will not have to have different skills in your development team and will have a neat and centralized way to handle the different problem type of every platform.
  8. 15 minutes
  9. 60 50 20