building cross platform mobile web apps

85

Upload: james-pearce

Post on 30-Oct-2014

13 views

Category:

Technology


0 download

DESCRIPTION

Frameworks like Sencha Touch are heralding a new way of building mobile services using Javascript, HTML5 and CSS3. If you want to discover how to use standard web technologies to reach your mobile users in beautiful app-like ways, this session is for you.We explore the possibilities that each of these rich, standards-based libraries can bring, we show how the mobile device is fast becoming a first-class Javascript run-time environment, and we discuss how we might be on the dawn of a new web age, where mobile and client-side applications can immerse billions of users with exciting, contextually-aware experiences.

TRANSCRIPT

Page 1: Building Cross Platform Mobile Web Apps
Page 2: Building Cross Platform Mobile Web Apps

James Pearce Director, Developer Relations @ jamespearce [email protected]

Page 3: Building Cross Platform Mobile Web Apps

Building Cross-Platform Mobile Web Apps

with

CSSHTML JS

Page 4: Building Cross Platform Mobile Web Apps

building( mobile.web().apps([ html5, css3, js ]).crossPlatform() );

Page 5: Building Cross Platform Mobile Web Apps

building( mobile.web().apps([ html5, css3, js ]).crossPlatform() );

Page 6: Building Cross Platform Mobile Web Apps

2008

We must have aniPhone App!

Page 7: Building Cross Platform Mobile Web Apps

2009

We must have anAndroid App!

Page 8: Building Cross Platform Mobile Web Apps

2010

We must have aniPad App!

Page 9: Building Cross Platform Mobile Web Apps

2011

We must have a...

Page 10: Building Cross Platform Mobile Web Apps
Page 11: Building Cross Platform Mobile Web Apps

omfg

Page 12: Building Cross Platform Mobile Web Apps

PalmMicrosoft

Apple

RIM

AndroidAndroidRIMAppleMicrosoftPalm

Top U.S. Smartphone Platforms,3 Month Average Ending Mar 2011comScore MobiLens 2011

Java

J2ME

Air

C++

C#

Obj-C

JS

Page 13: Building Cross Platform Mobile Web Apps

RIM

Microsoft

Android

Apple

Nokia

NokiaAppleAndroidMicrosoftRIM

Top EU5 Smartphone Platforms,3 Month Average Ending December 2010comScore MobiLens 2010

Lua

C

Python

C++

C#

Obj-C

J2ME

http://www.cloudfour.com/a-comprehensive-guide-to-mobile-statistics/

...

Java

Page 14: Building Cross Platform Mobile Web Apps
Page 15: Building Cross Platform Mobile Web Apps
Page 16: Building Cross Platform Mobile Web Apps

building( mobile.web().apps([ html5, css3, js ]).crossPlatform() );

Page 17: Building Cross Platform Mobile Web Apps

Cross-platformFamiliar skills & toolsDecentralizedEasily updatedIndexedWell-understood technologies

The Mobile Web

Page 18: Building Cross Platform Mobile Web Apps

Documents

Applications

Page 19: Building Cross Platform Mobile Web Apps

Declarative HTML

Programmatic JS

Page 20: Building Cross Platform Mobile Web Apps

Thin client

Thick client

Page 21: Building Cross Platform Mobile Web Apps

One PC

Multiple devices

Page 22: Building Cross Platform Mobile Web Apps

Sedentary usage

Mobile usage

Page 23: Building Cross Platform Mobile Web Apps
Page 24: Building Cross Platform Mobile Web Apps

building( mobile.web().apps([ html5, css3, js ]).crossPlatform() );

Page 25: Building Cross Platform Mobile Web Apps
Page 26: Building Cross Platform Mobile Web Apps
Page 27: Building Cross Platform Mobile Web Apps

A New Mobile App Stack

Javascript

Semantic HTML

CSS Styling & Layout

WebFonts Video Audio Graphics

Worker Parallel

Processing

File SystemsDBs

App Cache

x-AppMessaging

Device Access

Camera

Location

Contacts

SMS

Orientation

Gyro

Server & Services

HTTP

AJAX

Events

Sockets

SSL

More...

Page 28: Building Cross Platform Mobile Web Apps

Rich Media & StylingFull Resource Access

Parallel ProcessingInter-App Communication

Full O!ine Capability COMPLETE MODERN APP PLATFORM

Page 29: Building Cross Platform Mobile Web Apps

building( mobile.web().apps([ html5, css3, js ]).crossPlatform() );

Page 30: Building Cross Platform Mobile Web Apps
Page 31: Building Cross Platform Mobile Web Apps
Page 32: Building Cross Platform Mobile Web Apps
Page 33: Building Cross Platform Mobile Web Apps

building( mobile.web().apps([ html5, css3, js ]).crossPlatform() );

Page 34: Building Cross Platform Mobile Web Apps

WebKit FOEs

Page 35: Building Cross Platform Mobile Web Apps

HTML5 SupportIE 10 PR Chrome 10 Safari 5 Firefox 4 iOS4.31 Playbook Honeycomb

@font-faceCanvasHTML5 Audio & Videorgba(), hsla()border-image:border-radius:box-shadow:text-shadow:opacity:Multiple backgroundsFlexible Box ModelCSS AnimationsCSS ColumnsCSS GradientsCSS ReflectionsCSS 2D TransformsCSS 3D TransformsCSS TransitionsGeolocation APIlocal/sessionStorageSVG/SVG ClippingSMILInline SVGDrag and DrophashchangeX-window MessagingHistory ManagementapplicationCacheWeb SocketsWeb WorkersWeb SQL DatabaseWebGLIndexedDB

Page 36: Building Cross Platform Mobile Web Apps

Stay on top of diversityCan I Use?http://caniuse.com

Modernizrhttp://modernizr.com

DeviceAtlashttp://deviceatlas.com

Page 37: Building Cross Platform Mobile Web Apps
Page 38: Building Cross Platform Mobile Web Apps

ApplicationsDocuments

Programmatic DOMDeclarative HTML

APIsThemes

ArgumentsURLs

SynchronizationRequest/Response

Thick clientThin client

Page 39: Building Cross Platform Mobile Web Apps

jQTouch

UI layer on top of jQueryDeclarative HTMLLibrary progressively enhancesBrowsers: iOS (iPhone/iPod) Android BlackBerry v6 Most WebKit-based browsers

http://jQTouch.com

Page 40: Building Cross Platform Mobile Web Apps

jQTouch

Scripts & stylesheets

CSS classes for semantics & config

Page 41: Building Cross Platform Mobile Web Apps

jQuery Mobile (alpha)

UI layer on top of jQueryDeclarative HTMLLibrary progressively enhancesBrowsers: iOS (iPhone/iPad) Android BlackBerry v5+ Symbian v5, MeeGo, webOS

http://jquerymobile.com

Page 42: Building Cross Platform Mobile Web Apps

jQuery Mobile

data-* for semantics& config

Scripts & stylesheet

Page 43: Building Cross Platform Mobile Web Apps

Sencha Touch

Self-contained libraryProgrammatic JavascriptStandalone MVC applicationsBrowsers: iOS (iPhone/iPad) Android BlackBerry v6 & QNX Bada, MeeGo & other WebKit Windows Phone 7*

http://sencha.com/touch

* with IE9

Page 44: Building Cross Platform Mobile Web Apps

Sencha Touch

Data model& records

Programmatically createtoolbar & list

Page 45: Building Cross Platform Mobile Web Apps

Progressive Enhancement?

Page 46: Building Cross Platform Mobile Web Apps

Layouts & components Theming & icons Orientation & animationTouch events & scrollerData packageMVC framework

What’s in a good framework?

Page 47: Building Cross Platform Mobile Web Apps

Lists - Nested, Grouped, SortableCarouselPickerOverlaySliderForms & fieldsToolbars & buttonsHTML5 - Audio - Video - GeoLocation

Components

Page 48: Building Cross Platform Mobile Web Apps

Use CSS3 & SASS - Flexible themes - Highly optimized

Theming

Page 49: Building Cross Platform Mobile Web Apps

Forms

Page 50: Building Cross Platform Mobile Web Apps

ScrollingMomentum/bounce physics

Hardware accelerated

Throughout all components: - Lists - Carousel - Pickers

Page 51: Building Cross Platform Mobile Web Apps

Touch EventsBuilt on native events

Abstracted for performance

Additional events - Tap - Double tap - Tap and hold - Swipe - Rotate - Drag & drop

Page 52: Building Cross Platform Mobile Web Apps

Data PackageModels, Stores, and Proxies - Associations - Validation - Local & server storage

Easily consume web services - JSON/P - XML - YQL

Page 53: Building Cross Platform Mobile Web Apps

“The Kitchen Sink”

http://sencha.com/x/5e

Page 54: Building Cross Platform Mobile Web Apps

building( mobile.web().apps([ html5, css3, js ]).crossPlatform() );

Page 55: Building Cross Platform Mobile Web Apps

Evolving the web for mobile

HTML, CSS...

Models

Controllers

Views

Page 56: Building Cross Platform Mobile Web Apps

Models

Controllers

Mobile

DesktopSw

itch

er HTML, CSS...

Evolving the web for mobile

Page 57: Building Cross Platform Mobile Web Apps

JSON

Models

Controllers

Mobile

DesktopSw

itch

ers

RESTonce

Evolving the web for mobile

Page 58: Building Cross Platform Mobile Web Apps

The classic web stack

Storage

Business logic

User interfacereq/res

Rendering

Page 59: Building Cross Platform Mobile Web Apps

The next web stack?

Storage

Security Business logic

User interfacesync

Storage

Page 60: Building Cross Platform Mobile Web Apps

Write once,run anywhere?

Page 61: Building Cross Platform Mobile Web Apps

Er, no.

Page 62: Building Cross Platform Mobile Web Apps

The Mobile Webis not a

320px Web“

Page 63: Building Cross Platform Mobile Web Apps
Page 64: Building Cross Platform Mobile Web Apps

But you can re-usea lot of code

Page 65: Building Cross Platform Mobile Web Apps

Proxies

Models

Controllers

Stores

Views Views

json

Page 66: Building Cross Platform Mobile Web Apps

Thick client, thin server

The shortfall in the cloud

Page 67: Building Cross Platform Mobile Web Apps

Location Services

Image Serving

AnalyticsAdaptation

Video Serving

Data SyncWeb Fonts

Ad Serving

Commerce$

Network APIs

Page 68: Building Cross Platform Mobile Web Apps
Page 69: Building Cross Platform Mobile Web Apps

http://mysite.com/myimage.png

http://src.sencha.io/http://mysite.com/myimage.png

Page 70: Building Cross Platform Mobile Web Apps

Do we have time forsome code?

Page 71: Building Cross Platform Mobile Web Apps

Listvar list = new Ext.List({ store: store, itemTpl: '{firstName} {lastName}', grouped: true, indexBar: true});

Page 72: Building Cross Platform Mobile Web Apps

Nested Listvar list = new Ext.NestedList({ store: store, displayField: 'name', title: 'My List', updateTitleText: true, getDetailCard: function(record, parent) {..}});

Page 73: Building Cross Platform Mobile Web Apps

Carouselvar car = new Ext.Carousel({ direction: 'horizontal', indicator: true, items: [ .. ]});

Page 74: Building Cross Platform Mobile Web Apps

Sheetsvar sheet = new Ext.ActionSheet({ items: [ { text: 'Delete draft', ui: 'decline' }, { text: 'Save draft' }, { text: 'Cancel', } ]});sheet.show();

Page 75: Building Cross Platform Mobile Web Apps
Page 76: Building Cross Platform Mobile Web Apps

http://senchalearn.github.com/seattlebars/

Page 77: Building Cross Platform Mobile Web Apps

The cloud at work...

Location API to get lat/long

MongoLabs to get city name

Yelp to get businesses

Page 78: Building Cross Platform Mobile Web Apps

https://github.com/senchalearn/seattlebars

Page 79: Building Cross Platform Mobile Web Apps

Going o!ine

Page 80: Building Cross Platform Mobile Web Apps

A platform that allows you to author native applicationswith web technologies and get access to device APIs

PhoneGap

UIWebView WebView

HTMLCSS

JSStores

Page 81: Building Cross Platform Mobile Web Apps

Device Access

FileGeolocationMediaNetworkNotificationStorage

AccelerometerCameraCompassContactsDeviceEvents

http://docs.phonegap.com

Page 82: Building Cross Platform Mobile Web Apps

http://pmuellr.github.com/weinre/

Weinre

Page 83: Building Cross Platform Mobile Web Apps

building( mobile.web().apps([ html5, css3, js ]).crossPlatform() );

Page 84: Building Cross Platform Mobile Web Apps

Apps vs Web technologybuilt with

Page 85: Building Cross Platform Mobile Web Apps

James Pearce Director, Developer Relations @ jamespearce [email protected]