introduction to cordova

70
INTRODUCTION TO CORDOVA MAKING NATIVE-ONLY DEVS JEALOUS SINCE 2009

Upload: raymond-camden

Post on 19-Aug-2015

37 views

Category:

Internet


0 download

TRANSCRIPT

Page 1: Introduction to Cordova

INTRODUCTION TOCORDOVA

MAKING NATIVE-ONLY DEVS JEALOUS SINCE 2009

Page 2: Introduction to Cordova

WHO AM I?Developer Advocate for IBMFocused on MobileFirst and BluemixWeb Standards, HTML5, JavaScript,Mobile, ColdFusionwww.raymondcamden.com@raymondcamden

Page 3: Introduction to Cordova
Page 4: Introduction to Cordova
Page 5: Introduction to Cordova

GENESIS (OF PHONEGAP)Built at an iPhoneDevCamp in 2009Started by NitobiAdobe bought Nitobi (2011)Currently at 5.1.1

Page 6: Introduction to Cordova

$$$?PhoneGap is freeNo, really, freeOpen Source

Page 7: Introduction to Cordova

APACHE CORDOVAcordova.apache.orgPhoneGap is Adobe's implementationPhoneGap == Cordova

Page 8: Introduction to Cordova

LET'S GET TECHYCreates "Hybrid" applicationsNative wrapper around a web viewHTML (CSS,JS) handles layoutCordova "bridges the gap" to native capabilities

Page 9: Introduction to Cordova

ABOUT THAT GAP...Cordova tries to follow standardsWhen it doesn't need to do anything, it doesn'tIn the perfect world, Cordova won't exist

Page 10: Introduction to Cordova

SUPPORTED PLATFORMSiOSAndroidWindows Phone 8BlackBerry 10

(docs.cordova.io)Super Long URL

Page 11: Introduction to Cordova

OTHER PLATFORMSFirefox OSAmazon Fire OSUbuntuTizenWindows 8

Page 12: Introduction to Cordova

FEATURES (STUFF YOU CAN DO WITHJAVASCRIPT!)

Accelerometer - when the device movesCamera - pictures of your catCapture - audio, video, stills of your catCompass - for when you're lost in the woodsConnection - type of connection

Page 13: Introduction to Cordova

FEATURESContacts - find and create new friendsDevice - device and OS version metadataEvents - various app/hardware related eventsFile - native file system access (and upload/download)Geolocation - for when you're lost in the woods

Page 14: Introduction to Cordova

FEATURESGlobalization - date/number/currency formattingMedia - related to audio playback (supports record as well)Notification - visual, audible, and tactile notificationsSplashscreen - for your splash screen needs

Page 15: Introduction to Cordova

FEATURESPlugin API for anything you can imagine...

Page 16: Introduction to Cordova

UNOFFICIAL FEATURESUse any of the 10 million JavaScript librariesUse any of the 10 million APIsDeploy to app store

Page 17: Introduction to Cordova

NON-FEATURESUIUXNative Killer

Page 18: Introduction to Cordova

WHO IS USING CORDOVA?

Page 19: Introduction to Cordova

REAL WORLD DEMORay, click to the right if the demo worked.

Page 20: Introduction to Cordova
Page 21: Introduction to Cordova
Page 22: Introduction to Cordova
Page 23: Introduction to Cordova
Page 24: Introduction to Cordova
Page 25: Introduction to Cordova

HOW IS IT DONE?Going from HTML to BinaryMaking use of the "special" stuffThinking Differently

Page 26: Introduction to Cordova

HOW IS IT DONE?Install NodeInstall cordova via npm: sudo npm install -g cordova (Windowsfolks open your command prompt as an Admin)Get SDK(s) (technically optional)

Page 27: Introduction to Cordova

HOW IS IT DONE?Command line init to create the projectSwitch to your editorEdit HTML, simulate, build (via CLI)

Page 28: Introduction to Cordova

DEMOI'll show creating a project and explain what the folders

represent.

Page 29: Introduction to Cordova

ADDING PLATFORMScordova platforms add X (to add something)cordova platforms (to report)

Page 30: Introduction to Cordova

DEMOI'm going to show adding iOS and Android as well as checking

what is there/installed.

Page 31: Introduction to Cordova

BUILDING/EMULATING/TESTINGpreparecompilebuild == prepare + compileemulaterun

Page 32: Introduction to Cordova

MY CYCLEedit stuffcordova emulate

Page 33: Introduction to Cordova

DEMO

Page 34: Introduction to Cordova

HOW DO WE DO THE AWESOME?Include cordova.js (this will NOT exist in www)Wait for "deviceready" eventplugins for each feature (so to do X, you add the plugin X)config.xml (handles settings)

Page 35: Introduction to Cordova

DEMOI'm going to demo the camera API and totally screw it up.

Page 36: Introduction to Cordova

PLUGINSAll core features use pluginsAdditional features use pluginsEverything driven from CLI (list, add, and remove)

Page 37: Introduction to Cordova

DEMOLet's fix the camera demo.

Page 38: Introduction to Cordova

DEMOLet's show a few more: demos/contactpickerui,

demos/camera_vintagagejs, demos/mp3

Page 39: Introduction to Cordova

REAL WORLD BUILDINGDesktop BrowserMobile via WebRipple EmulatorLocal SDK to Simulator/Device

Page 40: Introduction to Cordova

DESKTOP BROWSERPro: Super FastPro: No setupPro: Debugging Rocks

Con: UI isn't rightCon: UX isn't rightCon: Features missingCon: Security restrictions

Page 41: Introduction to Cordova

MOBILE VIA WEBPro: Kinda FastPro: Minimal setupPro: UI and UX testing

Con: Features missingCon: Security restrictionsCon: Debugging sucks

Page 42: Introduction to Cordova

RIPPLE EMULATORPro: FastPro: Similar UIPro: FreePro: Security restrictions gone

Con: Not 100% supportedCon: Still not on the device

Page 43: Introduction to Cordova

LOCAL SDK TO SIMULATOR/DEVICEPro: The Real Deal

Con: Slow(ish)Con: Not FreeCon: Debugging *really* sucks

TO BE CLEAR: YOU MUST ALWAYS TEST ON A REAL DEVICE

Page 44: Introduction to Cordova

WHAT RAY DOES (MOST OF THE TIME...)DesktopiOS EmulatorGenymotion for Android: http://www.genymotion.com(Ray, show this)

Page 45: Introduction to Cordova

TESTING

Page 46: Introduction to Cordova

TESTINGOn Desktop, just continue to use dev tools.

Page 47: Introduction to Cordova

TESTINGOn Mobile, just continue to use dev tools.

Page 48: Introduction to Cordova

REMOTE DEBUGSafari for iOS, Chrome for Android"Full" dev tools for mobile web or Cordova

Page 49: Introduction to Cordova

DEMO

Page 50: Introduction to Cordova

GAPDEBUGhttps://www.genuitec.com/products/gapdebug/

Page 51: Introduction to Cordova

DEMO

Page 52: Introduction to Cordova

SO WHAT ABOUT THAT WHOLE "THINKDIFFERENT" THING?

Page 53: Introduction to Cordova

USER INTERFACE

Page 54: Introduction to Cordova

SUGGESTIONSLibraries (like Bootstrap)Responsive design and testing in general

Page 55: Introduction to Cordova

USER EXPERIENCE

Page 56: Introduction to Cordova

SUGGESTIONSLibraries (again)Testing on devicesHandling offline with client-side storage

Page 57: Introduction to Cordova

ARCHITECTURE

Page 58: Introduction to Cordova

SUGGESTIONSSingle Page ArchitectureAngularJS, jQuery Mobile, etc

Page 59: Introduction to Cordova

ALL IN ONE SOLUTION

Page 60: Introduction to Cordova

IONICFRAMEWORK.COM

Page 61: Introduction to Cordova

PHONEGAP BUILD

Page 62: Introduction to Cordova

THE 411Web based platform to do buildsSupports iOS, Android, Windows Phone, Blackberry, webOS,SymbianHas an API tooNO SDKS NO COMPILING NO MESS!

Page 63: Introduction to Cordova

$$$

Page 64: Introduction to Cordova

DEMO

Page 65: Introduction to Cordova

PHONEGAP DEVELOPERAPP

Page 66: Introduction to Cordova

Connects your desktop to your physical device (ios, android,windows phone)

Page 67: Introduction to Cordova

DEMO

Page 68: Introduction to Cordova

WHAT TO GO NEXT?Help - Google Group for PhoneGapDevelopers - people.phonegap.comcordova.apache.orgplugins.cordova.io

Page 69: Introduction to Cordova

"APACHE CORDOVA IN ACTION"

manning.com/camden

Page 70: Introduction to Cordova

THANK YOU!