bridging the gap from a web app to a mobile app et al 26 html5 devcon - april, 2013 build services...

48
Bridging the Gap: from a Web App to a Mobile Device App …or, so how does this PhoneGap* stuff work? *Other names and brands may be claimed as the property of others. HTML5 DevCon - April, 2013 1

Upload: lycong

Post on 07-Mar-2018

218 views

Category:

Documents


3 download

TRANSCRIPT

Bridging the Gap: from a Web App to a Mobile Device App

…or, so how does this PhoneGap* stuff work? *Other names and brands may be claimed as the property of others.

HTML5 DevCon - April, 2013 1

Users Want Mobile Apps, Not Mobile Websites

HTML5 DevCon - April, 2013 2

http://www.cioinsight.com/it-strategy/application-development/slideshows/users-want-mobile-apps-not-mobile-websites/

Why Mobile Apps, Rather than Mobile Websites?

HTML5 DevCon - April, 2013 3

http://www.cioinsight.com/it-strategy/application-development/slideshows/users-want-mobile-apps-not-mobile-websites/

State of the Smartphone Market

Strategy Analytics, Global Smartphone OS Market Shares by Region, Q4 2012, Feb’13

HTML5 DevCon - April, 2013 4

And if You’re in It for the Money…

HTML5 DevCon - April, 2013 5

So What Does it Take to Build an App?

HTML5 DevCon - April, 2013 6

Creating Conventional “Native” Apps…

HTML5 DevCon - April, 2013 7

Sorry for these very bad graphics!

…Means Working Inside Walled Gardens

HTML5 DevCon - April, 2013 8

Sorry for these extremely bad graphics!

What’s Common Across these Platforms?

Apple* iOS* Blackberry* Google* Android*

M icrosoft* Windows* Phone

Mozilla* Firefox* OS

Tizen*

Development model

Closed, controlled by Apple

Closed, controlled by Blackberry

Platform code released to open source after first commercial device ships; key pieces are Google proprietary

Closed, controlled by Microsoft

Open source, code released during development; controlled by Mozilla

Open source, code released during development. Controlled by Tizen TSG, co-chaired by Intel and Samsung

APIs

Objective C; HTML5 in browser; hybrid

C/C++; HTML5; hybrid; Java

Java; restricted C/C++; HTML5 in browser; hybrid

C/C++; managed (C#, JavaScript); HTML5 with Microsoft extensions

HTML5 only with Mozilla extensions

HTML5 with Tizen extensions; C/C++

Architecture support

ARM only ARM only ARM and x86 ARM only ARM only ARM and x86

OEM and service

provider support

Leading OEM, broad SP support

1 OEM, good SP support

Many OEMs, broad SP support

Many OEMs, broad SP support

Limited OEMs, good SP support

Supported by leading OEM, good SP support

Device categories supported

Smartphone, tablet, TV

Smartphone, tablet

Smartphone, tablet, TV

Smartphone, tablet Entry smartphone

Smartphone, tablet IVI, TV, PC

HTML5 DevCon - April, 2013 9

Can You Create Native Apps from Web Apps?

HTML5 DevCon - April, 2013 10

Web vs. Hybrid vs. HTML5 Applications

HTML5 DevCon - April, 2013 11

Web App limited

sensor input

Hybrid App full

sensor input

HTML5 App full

device access

Runs w/o network Yes Yes Yes

Flexible Layout Yes Yes Yes

Device APIs Limited Mostly Complete

Distribution URL Native Binary URL/WGT

Cross Platform Yes Yes & No Yes

Runs in Browser Yes No No

Runs in Web Runtime No Yes Yes

Tomorrow

the HTML5 standard is evolving to include device APIs

Today

Use HTML/CSS/JS for UI and Program Logic…

HTML5 DevCon - April, 2013 12

…and /fōn•gap/ for Device Feature Access

HTML5 DevCon - April, 2013 13

/fōn•gap/ is a Cross Platform Tool (CPT)

HTML5 DevCon - April, 2013 14

/fōn•gap/ is NOT…

… a magic elixir – won’t auto-magically make your app aware of device features

… a compiler or translator – does not convert HTML5 code into native code

… a “browser bundler” – does not bundle a browser with your application

– not like Chrome Embedded Framework (aka CEF) or Node-Webkit

» it is not the same as using tools like: – Appcelerator*

– Mosync*

– Marmalade*

– Xamarin*

– et al

HTML5 DevCon - April, 2013 15

Apache Cordova* Essentials pronounced /fōn•gap/

PhoneGap* is a trademark of Adobe*

Adobe* PhoneGap* is a “distribution” of Apache Cordova*

*Other names and brands may be claimed as the property of others.

HTML5 DevCon - April, 2013 16

Apache Cordova (/fōn•gap/) Device APIs

Accelerometer Camera Capture Compass Connection Contacts Device Events File Geolocation Globalization InAppBrowser Media Notification Splashscreen Storage

HTML5 DevCon - April, 2013 17

Apache Cordova (/fōn•gap/) API Sampling

Accelerometer navigator.accelerometer.getCurrentAcceleration(accSuccess,accError);

var watchID = navigator.accelerometer.watchAcceleration(accSuccess,accError,[accOptions]);

navigator.accelerometer.clearWatch(watchID);

Camera navigator.camera.getPicture(cameraSuccess,cameraError,[cameraOptions]);

navigator.camera.cleanup(cameraSuccess,cameraError);

Compass navigator.compass.getCurrentHeading(compassSuccess,compassError,compassOptions);

var watchID = navigator.compass.watchHeading(compassSuccess,compassError,[cOptions]);

navigator.compass.clearWatch(watchID);

Geolocation navigator.geolocation.getCurrentPosition(geoSuccess,[geoError],[geoOptions]);

var watchId = navigator.geolocation.watchPosition(geoSuccess,[geoError],[geoOptions]);

navigator.geolocation.clearWatch(watchID);

ref: http://docs.phonegap.com/

HTML5 DevCon - April, 2013 18

Apache Cordova Platform Support Levels

Core – primary platforms supported by Apache Cordova – iOS – Android

– BlackBerry

– Windows Phone & Windows 8

Horizon –some level of support, future core support candidates – Tizen

– Qt

– Firefox OS – Ubuntu Mobile (Qt)

– Windows Desktop (Win32)

Sunset –code available, but no distribution of these platforms – Symbian

– webOS

– Bada

ref: http://wiki.apache.org/cordova/PlatformSupport

HTML5 DevCon - April, 2013 19

Apache Cordova Method of Operation

Write your HTML5 “web app” using HTML/CSS/JavaScript

Open a “native web-view” inside a “native app”

Package your “web app” inside that “native web-view”

Deploy your “web app” as a “hybrid native app”

ref: http://wiki.apache.org/cordova/AddingNewPlatforms

HTML5 DevCon - April, 2013 20

Apache Cordova Application Block Diagram

HTML5 DevCon - April, 2013 21

System Services

Operating System

Native Web Runtime

Your Web App cordova.js

cordova plugins

Mobile Device Hardware

Just Think of it as a Tasty “Black and Tan”

(if you don’t like beer, think of it as an “Arnold Palmer”)

HTML5 DevCon - April, 2013 22

Web App Stuff (stout)

Native App Stuff (pale ale)

/fōn•gap/

stuff

Where Does One Start?

HTML5 DevCon - April, 2013 23

http://wiki.apache.org/cordova

http://docs.phonegap.com http://phonegap.com

https://github.com/phonegap/phonegap

Learn to use Android, Xcode and VS’12 SDKs!?

HTML5 DevCon - April, 2013 24

Learn to use Android, Xcode and VS’12 SDKs!?

HTML5 DevCon - April, 2013 25

Online HTML5 Mobile App Build Services

Adobe* PhoneGap* Build*

– http://build.phonegap.com

Intel® XDK

– http://software.intel.com/html5tools

Tiggzi* Mobile App Builder*

– https://appbuilder.tiggzi.com/projects

Trigger.io*

– https://trigger.io

ApplicationCraft*

– http://www.applicationcraft.com/blog/2012/11/ac-mobile-build

et al

HTML5 DevCon - April, 2013 26

Build services may not be interoperable!

Online Build Supported Platforms

HTML5 DevCon - April, 2013 27

Adobe* PhoneGap* Build*

Intel® XDK Other Options

(typical)

iOS*

Android*

Windows* Phone 7

Blackberry*

WebOS*

Symbian*

Tizen* (soon)

Windows* 8 (soon)

Android SDK and /fōn•gap/ Project Example

HTML5 DevCon - April, 2013 28

HTML5 Device App on My Local Disk

config.xml gives directions to the build process

HTML5 DevCon - April, 2013 29

HTML5 Device App in an Android APK

an APK is just a zip file

build process adds some /fōn•gap/ specific files

HTML5 DevCon - April, 2013 30

an XAP is also just a zip file

some of the “native wrapper” bits in a Windows Phone app

HTML5 Device App in a Windows Phone XAP

HTML5 DevCon - April, 2013 31

Load Your Script Files Locally, Not via a CDN

HTML5 DevCon - April, 2013 32

Inside a Browser vs. Inside a WebView

HTML5 DevCon - April, 2013 33

iOS /fōn•gap/ Plugins

HTML5 DevCon - April, 2013 35

Android /fōn•gap/ Plugins

HTML5 DevCon - April, 2013 36

And a Few Other Platforms…

HTML5 DevCon - April, 2013 37

Debug Using Intel® XDK Device Emulator

HTML5 DevCon - April, 2013 38

Debug Using Intel® XDK Device Emulator

HTML5 DevCon - April, 2013 39

Debug Using Apache* Ripple* Device Emulator

HTML5 DevCon - April, 2013 40

Debug Using Apache* Ripple* Device Emulator

HTML5 DevCon - April, 2013 41

HTML5 Device Application Challenges

App Store Fragmentation

Performance

Debugging

Testing

Device APIs

Security

etc.

HTML5 DevCon - April, 2013 42

HTML5 Trades Optimization for Portability

HTML5 DevCon - April, 2013 43

Why Does Intel Love HTML5?

44

HTML5 is advanced

Intel takes HTML5 further with new APIs and Parallel JavaScript

HTML5 is open

Intel advances HTML5 via open source projects and the W3C

HTML5 is everywhere

Intel supports HTML5 developers with new tools and communities

Learn more at software.intel.com/html5

HTML5 DevCon - April, 2013

Taking HTML5 Further

45

** Partial List as of January, 2013

Develop ways for web pages to interact

with NFC devices

W3C NFC WG

Develop and maintain cascading style sheets

3 Intel members

W3C CSS WG

HTML5 core, elements, layouts, DOM

W3C HTML WG

Security and policy mechanisms to improve

security of web applications

2 Intel members

W3C WebApp

Security WG

Define cryptography APIs to provide

common functionality to web applications

W3C Web

Cryptography WG

Add more advanced audio capabilities, such

as the processing and synthesis of audio

streams

W3C Audio WG

Define runtime environment, security model

and associated APIs to build web apps

similar to native

W3C System

Applications WG

Improve privacy and user control

W3C

Tracking Protection WG

Improve client-side application development

on the web

W3C Web

Applications WG

Enhance application performance of user

agent features and APIs

W3C Web

Performance WG

Enable web application interaction with

device HW, services, and applications

W3C Device

API WG

Develop technologies for use in testing,

debugging, and troubleshooting of web

applications

W3C

Browser Testing and Tools

HTML5 DevCon - April, 2013

Leading Open Source Contributor

HTML5 DevCon - April, 2013 46

software.intel.com/html5

HTML5 DevCon - April, 2013 47