67

Building Cloud-Based Cross-Platform Mobile Web Apps

Embed Size (px)

DESCRIPTION

As presented at http://www.meetup.com/MobileCloud/events/17159747/The web is always evolving, but we're witnessing a significant architectural shift as services migrate to the cloud, business logic moves to ever-thicker clients, and the web escapes the desktop to become a beautifully mobile medium.In this environment, web application frameworks like Sencha Touch offer a new way of building mobile services using HTML5, CSS3, and JavaScript. We'll explore the possibilities that this rich, standards-based approach can bring, how to develop mobile web apps that look and feel native on iPhone, Android, and BlackBerry touch devices, and how to leverage the power of cloud-based services to provide scalable and compelling applications in this new world.

Citation preview

Page 1: Building Cloud-Based Cross-Platform Mobile Web Apps
Page 2: Building Cloud-Based Cross-Platform Mobile Web Apps

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

Page 3: Building Cloud-Based Cross-Platform Mobile Web Apps

Building Cloud-based Cross-Platform Mobile

Web Appswith

CSSHTML JS

Page 4: Building Cloud-Based Cross-Platform Mobile Web Apps

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

Page 5: Building Cloud-Based Cross-Platform Mobile Web Apps

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

Page 6: Building Cloud-Based Cross-Platform Mobile Web Apps

2008

We must have aniPhone App!

Page 7: Building Cloud-Based Cross-Platform Mobile Web Apps

2009

We must have anAndroid App!

Page 8: Building Cloud-Based Cross-Platform Mobile Web Apps

2010

We must have aniPad App!

Page 9: Building Cloud-Based Cross-Platform Mobile Web Apps

2011

We must have a...

Page 10: Building Cloud-Based Cross-Platform Mobile Web Apps
Page 11: Building Cloud-Based Cross-Platform Mobile Web Apps

omfg

Page 12: Building Cloud-Based Cross-Platform Mobile Web Apps
Page 13: Building Cloud-Based Cross-Platform Mobile Web Apps
Page 14: Building Cloud-Based Cross-Platform Mobile Web Apps

PalmMicrosoft

Apple

Android

RIM RIMAndroidAppleMicrosoftPalm

Top U.S. Smartphone Platforms,3 Month Average Ending December 2010comScore MobiLens 2010

Java

J2ME

Air

C++

C#

Obj-C

JS

Page 15: Building Cloud-Based Cross-Platform Mobile Web Apps

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

Page 16: Building Cloud-Based Cross-Platform Mobile Web Apps

Cross-platformFamiliar skills & toolsDecentralizedEasily updatedIndexedWell-understood technologies

The Mobile Web

Page 17: Building Cloud-Based Cross-Platform Mobile Web Apps

ApplicationsDocuments

Programmatic DOMDeclarative HTML

APIsThemes

ArgumentsURLs

SynchronizationRequest/Response

Thick clientThin client

The Web is Evolving...

Page 18: Building Cloud-Based Cross-Platform Mobile Web Apps
Page 19: Building Cloud-Based Cross-Platform Mobile Web Apps

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

Page 20: Building Cloud-Based Cross-Platform Mobile Web Apps

localStorage

WebSQL

gradient

-webkit

CSS Text

GeoLocation

canvastype=camera

@page

@mediamanifest

accelerometer

keyframe

transform<video>

Page 21: Building Cloud-Based Cross-Platform Mobile Web Apps
Page 22: Building Cloud-Based Cross-Platform Mobile Web Apps
Page 23: Building Cloud-Based Cross-Platform Mobile Web Apps

A New Mobile App Stack

Worker Parallel

Processing

File SystemsDBs

App Cache

Javascript

Semantic HTML

CSS Styling & Layout

WebFonts Video Audio Graphics

x-AppMessaging

Device Access

Camera

Location

Contacts

SMS

Orientation

Gyro

Server & Services

HTTP

AJAX

Events

Sockets

SSL

More...

Page 24: Building Cloud-Based Cross-Platform Mobile Web Apps

Rich Media & StylingFull Resource Access

Parallel ProcessingInter-App Communication

Full O!ine Capability COMPLETE MODERN APP PLATFORM

Page 25: Building Cloud-Based Cross-Platform Mobile Web Apps

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

Page 26: Building Cloud-Based Cross-Platform Mobile Web Apps
Page 27: Building Cloud-Based Cross-Platform Mobile Web Apps
Page 28: Building Cloud-Based Cross-Platform Mobile Web Apps
Page 29: Building Cloud-Based Cross-Platform Mobile Web Apps

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

Page 30: Building Cloud-Based Cross-Platform Mobile Web Apps

WebKit FOEs

Page 31: Building Cloud-Based 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 32: Building Cloud-Based Cross-Platform Mobile Web Apps

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

Modernizrhttp://modernizr.com

DeviceAtlashttp://deviceatlas.com

Page 33: Building Cloud-Based Cross-Platform Mobile Web Apps
Page 34: Building Cloud-Based Cross-Platform Mobile Web Apps

ApplicationsDocuments

Programmatic DOMDeclarative HTML

APIsThemes

ArgumentsURLs

SynchronizationRequest/Response

Thick clientThin client

Page 35: Building Cloud-Based Cross-Platform Mobile Web Apps
Page 36: Building Cloud-Based Cross-Platform Mobile Web Apps

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

What’s in Sencha Touch?

Page 37: Building Cloud-Based Cross-Platform Mobile Web Apps

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

Components

Page 38: Building Cloud-Based Cross-Platform Mobile Web Apps

Use CSS3 & SASS - Flexible themes - Highly optimized

Theming

Page 39: Building Cloud-Based Cross-Platform Mobile Web Apps

Forms

Page 40: Building Cloud-Based Cross-Platform Mobile Web Apps

ScrollingMomentum/bounce physics

Hardware accelerated

Throughout all components: - Lists - Carousel - Pickers

Page 41: Building Cloud-Based 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 42: Building Cloud-Based Cross-Platform Mobile Web Apps

“The Kitchen Sink”

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

Page 43: Building Cloud-Based Cross-Platform Mobile Web Apps

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

Page 44: Building Cloud-Based Cross-Platform Mobile Web Apps

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

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

Page 45: Building Cloud-Based Cross-Platform Mobile Web Apps

Evolving a site for mobile

HTML, CSS...

Models

Controllers

Views

Page 46: Building Cloud-Based Cross-Platform Mobile Web Apps

Evolving a site for mobile

Models

Controllers

Mobile

DesktopSw

itch

er HTML, CSS...

Page 47: Building Cloud-Based Cross-Platform Mobile Web Apps

A dedicated mobile app

JSON

Models

Controllers

Mobile

DesktopSw

itch

ers

RESTonce

Page 48: Building Cloud-Based Cross-Platform Mobile Web Apps

Thematic consistency

http://mysite.com/posts/123

http://mysite.com/#!/posts/123

Page 49: Building Cloud-Based Cross-Platform Mobile Web Apps

The stack of the present

Storage

Business logic

User interfacereq/res

Rendering

Page 50: Building Cloud-Based Cross-Platform Mobile Web Apps

A stack of the future

Storage

Security Business logic

User interfacesync

Storage

Page 51: Building Cloud-Based Cross-Platform Mobile Web Apps

<aside>

</aside>

JSON          JavaScript  Object  Notation

JSON-­‐P      JSON  with  Padding

CORS          Cross-­‐Origin  Resource  Sharing

Page 52: Building Cloud-Based Cross-Platform Mobile Web Apps

Thick client, thin server

The shortfall in the cloud

Page 53: Building Cloud-Based Cross-Platform Mobile Web Apps

Location Services

Image Serving

AnalyticsAdaptation

Video Serving

Data SyncWeb Fonts

Ad Serving

Commerce$

Network APIs

Page 54: Building Cloud-Based Cross-Platform Mobile Web Apps

http://mysite.com/myimage.png

http://i.tinysrc.mobi/http://mysite.com/myimage.png

Page 55: Building Cloud-Based Cross-Platform Mobile Web Apps

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

Page 56: Building Cloud-Based Cross-Platform Mobile Web Apps

Do we have time forsome code?

Page 57: Building Cloud-Based Cross-Platform Mobile Web Apps
Page 58: Building Cloud-Based Cross-Platform Mobile Web Apps

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

Page 59: Building Cloud-Based 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 60: Building Cloud-Based Cross-Platform Mobile Web Apps

https://github.com/senchalearn/seattlebars

Page 61: Building Cloud-Based Cross-Platform Mobile Web Apps

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

http://phonegap.com

PhoneGap

Page 62: Building Cloud-Based Cross-Platform Mobile Web Apps

+

Page 63: Building Cloud-Based Cross-Platform Mobile Web Apps

PhoneGap Build

Page 64: Building Cloud-Based Cross-Platform Mobile Web Apps

Device Access

FileGeolocationMediaNetworkNotificationStorage

AccelerometerCameraCompassContactsDeviceEvents

http://docs.phonegap.com

Page 65: Building Cloud-Based Cross-Platform Mobile Web Apps

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

Page 66: Building Cloud-Based Cross-Platform Mobile Web Apps

Apps vs Web technologybuilt with

Page 67: Building Cloud-Based Cross-Platform Mobile Web Apps

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