Post on 08-Feb-2017
He had to work very hard to resist the temptation to fill this presentation with Star Wars references.
Cordova 101This is the tool you’re looking for!
Package Web Apps for mobile
Build once, run (almost) anywhere
What is it?
• PhoneGap == Cordova
• PhoneGap Build is a whole different thing
• Open Source Apache Project
• Builds apps from the same* code for different platforms
How it works
• Packaged HTML, CSS & JavaScript
• Interface APIs for native functionality
• Compiled using mobile dev tools du platform
• Rendered in WebView on mobile
$ npm install -g cordova
$ cordova create MyApp
$ cd MyApp
$ cordova platform add browser
$ cordova run browser
Getting Started
Before you can app it up…• You need the developer tools for your mobile platform
installed:
• Android SDK for Android / Amazon Fire
• Xcode for iOS
• BlackBerry WebWorks SDK
• Visual Studio 2013 Express for Windows Phone
• You may need a developer account (iOS)
$ npm install -g ios-sim
$ npm install -g ios-deploy
$ cordova platform add iOS
$ cordova prepare
$ cordova emulate ios
Getting Started with iOS
Inside a Cordova Project• /config.xml - main config file for your Cordova App
• /www/ - web root for your app (html, css, js, images, etc.)
• /plugins/ - any plugins you want to use
• /platforms/ - configs & assets for specific platforms
• /hooks/ - scripts to do stuff at various points in the build
Plugins!• All device APIs are plugins
• Disabled by default
• Install using the CLI for cross platform apps or
• Install using Plugman for single platform apps
Inside your app
• Always load cordova.js
• Load assets using relative urls
• Use an SPA approach
• If using jQuery, use onDeviceReady: function() not document.ready