flex 4.5 and mobile development

42
© 2011 Adobe Systems Incorporated. All Rights Reserved. Adobe Condential. Michaël Chaize | Flash Platform Evangelist | www.RIAgora.com | @mchaize Flex 4.5 et les applications mobiles

Upload: michael-chaize

Post on 16-May-2015

2.442 views

Category:

Technology


4 download

TRANSCRIPT

Page 1: Flex 4.5 and mobile development

© 2011 Adobe Systems Incorporated. All Rights Reserved. Adobe Con!dential.

Michaël Chaize | Flash Platform Evangelist | www.RIAgora.com | @mchaizeFlex 4.5 et les applications mobiles

Page 2: Flex 4.5 and mobile development

© 2010 Adobe Systems Incorporated. All Rights Reserved. Adobe Con!dential.

Adobe Flex

2

Page 3: Flex 4.5 and mobile development

© 2011 Adobe Systems Incorporated. All Rights Reserved. Adobe Con!dential.© 2011 Adobe Systems Incorporated. All Rights Reserved. Adobe Con!dential.

Flex SDK

Flex Class Library

MXML ActionScript

Debuggers

How Flex Works in the Browser

Compile

SOAP HTTP/S AMF/S RTMP/S

Web Server

Existing Applications & Infrastructure

J2EE Application Server

Adobe Data ServicesXML/HTTPREST

SOAP Web Services

Browser

Flash Player

Flash Builder IDE

Page 4: Flex 4.5 and mobile development

© 2010 Adobe Systems Incorporated. All Rights Reserved. 4

Customer care @ Adobe

Page 5: Flex 4.5 and mobile development

© 2010 Adobe Systems Incorporated. All Rights Reserved. 5

Adobe Hendrix

15%solve a case

+10%customer

satisfaction

1day training

Page 6: Flex 4.5 and mobile development

© 2010 Adobe Systems Incorporated. All Rights Reserved. Adobe Con!dential.

All external content and images pending approvals.

6

System-centric applications

Page 7: Flex 4.5 and mobile development

© 2010 Adobe Systems Incorporated. All Rights Reserved. Adobe Con!dential.

All external content and images pending approvals.

7

System-centric applications

Page 8: Flex 4.5 and mobile development

®

Copyright 2009 Adobe Systems Incorporated. All rights reserved. Adobe con!dential. 8

Rich Internet Application

Page 9: Flex 4.5 and mobile development

©2010 Adobe Systems Incorporated. All Rights Reserved. Adobe Con!dential.

Flex & Java

&

Richness / Fast / Open-source / Industrialization

Page 10: Flex 4.5 and mobile development

© 2011 Adobe Systems Incorporated. All Rights Reserved. Adobe Con!dential.© 2011 Adobe Systems Incorporated. All Rights Reserved. Adobe Con!dential.

"e explosion of devices introduces new challenges for application development

Page 11: Flex 4.5 and mobile development

© 2010 Adobe Systems Incorporated. All Rights Reserved. Adobe Con!dential. 11

Technology Partners

Open Screen Project: Adobe et plus de 70 partenaires

Content Partners

Page 12: Flex 4.5 and mobile development

© 2011 Adobe Systems Incorporated. All Rights Reserved. Adobe Con!dential.© 2011 Adobe Systems Incorporated. All Rights Reserved. Adobe Con!dential.© 2011 Adobe Systems Incorporated. All Rights Reserved. Adobe Con!dential.

Native Mobile Application Development Model

NativeApp

NativeApp

NativeApp

NativeApp

Additional OS’s

A costly, inefficient development model

Page 13: Flex 4.5 and mobile development

© 2011 Adobe Systems Incorporated. All Rights Reserved. Adobe Con!dential.© 2011 Adobe Systems Incorporated. All Rights Reserved. Adobe Con!dential.© 2011 Adobe Systems Incorporated. All Rights Reserved. Adobe Con!dential.

Introducing a new mobile development paradigm

Additional OS’s

AIR

Flex Application

One Tool, One Language, One Codebase

Any Platform

Common codebase

Page 14: Flex 4.5 and mobile development

© 2011 Adobe Systems Incorporated. All Rights Reserved. Adobe Con!dential.© 2011 Adobe Systems Incorporated. All Rights Reserved. Adobe Con!dential.© 2011 Adobe Systems Incorporated. All Rights Reserved. Adobe Con!dential.

Platforms, browsers, and devices

In-browser

Outside the browser

Set-top boxes (Future)

Mobile Platforms

Page 15: Flex 4.5 and mobile development

© 2010 Adobe Systems Incorporated. All Rights Reserved. Adobe Con!dential.

Adobe Flex 4.5

15

4.5

Page 16: Flex 4.5 and mobile development

SPARK COMPONENT MODEL

FLEX FRAMEWORK 4

ActionScript MXML

GraphicsLayout

AnimationParts

States

Component Skin

CSS properties

BehaviorLogicData

http://www.lafabrick.com/labz/skins/jellySkin/

Page 17: Flex 4.5 and mobile development

© 2010 Adobe Systems Incorporated. All Rights Reserved.

Mobile Applications in Flex 4.5

17

s:TabbedViewNavigatorApplications:ViewNavigatorApplications:Application

Page 18: Flex 4.5 and mobile development

© 2010 Adobe Systems Incorporated. All Rights Reserved.

<s:ViewNavigatorApplication> life cycle

18

views.ListEmployees views.DetailsEmployee views.ListEmployees

DATA DATA

persisted in memory

subset

view destroyed view created

view destroyed view created

“BACK” bu!on

Page 19: Flex 4.5 and mobile development

© 2010 Adobe Systems Incorporated. All Rights Reserved.

ActionBar

<s:View xmlns:fx=http://ns.adobe.com/mxml/2009 … title=”Expenses"> <s:navigationContent> <s:Button icon="@Embed('assets/home.png')"/> </s:navigationContent> <s:actionContent> <s:Button label=”+"/> </s:actionContent></s:View>

19 3

navigationContent titleContent actionContent

Page 20: Flex 4.5 and mobile development

© 2010 Adobe Systems Incorporated. All Rights Reserved. Adobe Con!dential.

Un problème technique: la densité des écrans

20

150 x 40 pixel bu$on

Desktop monitor@100 dpi

= 1.5” x 0.4”

Galaxy Tab@160 dpi

= 0.9” x 0.25”

Droid 2@240 dpi

= 0.6” x 0.17”

iPhone 4@320 dpi

= 0.46” x 0.13”

Un même nombre de pixels pour différentes tailles physiques

Page 21: Flex 4.5 and mobile development

© 2010 Adobe Systems Incorporated. All Rights Reserved. Adobe Con!dential.

Can I use dynamic layout to solve this?

21

(Not easily. You can make stuff "ll the screen using percent sizing, but your fonts and icons will still be tiny. And any "xed pixel sizes, e.g. in constraint-based layouts or padding values, will be wrong.)

(Not easily. You can make stuff "ll the screen using percent sizing, but your fonts and icons will still be tiny. And any "xed pixel sizes, e.g. in constraint-based layouts or padding values, will be wrong.)

320x480 @160dpi 640x960 (at same density) 640x960 @320dpi

100%

100%

100%

100%

Page 22: Flex 4.5 and mobile development

© 2010 Adobe Systems Incorporated. All Rights Reserved. Adobe Con!dential.

Flex 4.5 et la mise à l’échelle automatique

22

<Application applicationDPI=“160”> <Button width=“160” height=“40”/></Application>

160 dpi 240 dpi 320dpi

Scaled 1.5x Scaled 2x

Page 23: Flex 4.5 and mobile development

© 2010 Adobe Systems Incorporated. All Rights Reserved. Adobe Con!dential.

Scaling different types of objects

23

Vectorsscale up well

(scaling down can be bad)Outlines may blur slightly

Textscales up well

(Flash scales font size)

Lorem

Ipsum

Dolor

Bitmapsdo not scale up well

Page 24: Flex 4.5 and mobile development

© 2010 Adobe Systems Incorporated. All Rights Reserved. Adobe Con!dential.

Flex density concepts: Multi-DPI bitmaps

<Button click="dealSummaryList.refresh()"> <icon> <MultiDPIBitmapSource source160dpi="@Embed('assets/refresh160.png')" source240dpi="@Embed('assets/refresh240.png')" source320dpi="@Embed('assets/refresh320.png')"/> </icon></Button>

24

<?xml version="1.0" encoding="utf-8"?><s:ViewNavigatorApplication applicationDPI="160"> ...</s:ViewNavigatorApplication>

Page 25: Flex 4.5 and mobile development

© 2010 Adobe Systems Incorporated. All Rights Reserved.

ViewMenu

25 3

...<s:viewMenuItems>                <s:ViewMenuItem  label="Add"  click="itemClickInfo(event)"  icon="{addIcon}"    iconPlacement="left"  />                <s:ViewMenuItem  label="Remove"  click="itemClickInfo(event)"  icon="{delIcon}"  iconPlacement="left"  />                <s:ViewMenuItem  label="Find"  click="itemClickInfo(event)"  icon="{findIcon}"  iconPlacement="left"/>                <s:ViewMenuItem  label="Next"  click="itemClickInfo(event)"  icon="{nextIcon}"  iconPlacement="left"/>                <s:ViewMenuItem  label="Prev"  click="itemClickInfo(event)"  icon="{prevIcon}"  iconPlacement="left"/></s:viewMenuItems>...

Page 26: Flex 4.5 and mobile development

© 2010 Adobe Systems Incorporated. All Rights Reserved. Adobe Con!dential.

Flex 4.5 and smartphones/tablets

26

BlackBerry PlayBookAndroid tablets Apple tablets

Page 27: Flex 4.5 and mobile development

© 2011 Adobe Systems Incorporated. All Rights Reserved. Adobe Con!dential.© 2011 Adobe Systems Incorporated. All Rights Reserved. Adobe Con!dential.

Demo

27

Page 28: Flex 4.5 and mobile development

© 2010 Adobe Systems Incorporated. All Rights Reserved.

Mobile APIs

28

Page 29: Flex 4.5 and mobile development

© 2010 Adobe Systems Incorporated. All Rights Reserved.

GEO APIs

§ Android Permission Required:

<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" /> <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />

§ Geolocation.isSupported

§ g.addEventListener(GeolocationEvent.UPDATE, callbackFunction);

§ GeolocationEvent:

§ altitude

§ heading

§ horizontalAccuracy

§ latitude

§ longitude

§ speed

§ timestamp

§ verticalAccuracy

Page 30: Flex 4.5 and mobile development

© 2010 Adobe Systems Incorporated. All Rights Reserved.

Accelerometer APIs

§ Accelerometer.isSupported

§ a.addEventListener(AccelerometerEvent.UPDATE, callbackFunction);

§ AccelerometerEvent:

§ accelerationX

§ accelerationY

§ accelerationZ

§ timestamp

Page 31: Flex 4.5 and mobile development

© 2010 Adobe Systems Incorporated. All Rights Reserved.

Multi-Touch APIs

§ Android manifest change:

<uses-feature android:required="true" android:name="android.hardware.touchscreen.multitouch"/>

§ Gesture OR Multitouch --- Multitouch.inputMode

§ MultitouchInputMode.GESTURE

§ TransformGestureEvent

§ GESTURE_PAN

§ GESTURE_ROTATE

§ GESTURE_SWIPE

§ GESTURE_ZOOM

§ GestureEvent.GESTURE_TWO_FINGER_TAP

§ PressAndTapGestureEvent.GESTURE_PRESS_AND_TAP

§ MultitouchInputMode.TOUCH_POINT

§ TouchEvent

§ TOUCH_BEGIN

§ TOUCH_END

§ TOUCH_MOVE

§ TOUCH_OUT

§ TOUCH_OVER

§ TOUCH_ROLL_OUT

§ TOUCH_ROLL_OVER

§ TOUCH_TAP

Page 32: Flex 4.5 and mobile development

© 2010 Adobe Systems Incorporated. All Rights Reserved.

Remote Data

§ Android Permission Required:

<uses-permission android:name="android.permission.INTERNET"/>

§ Standard Flex Networking Libraries:

§ HTTPService

§ WebService

§ RemoteObject

Page 33: Flex 4.5 and mobile development

© 2010 Adobe Systems Incorporated. All Rights Reserved.

Full Screen & Orientation

§ stage.displayState = StageDisplayState.NORMAL

§ stage.displayState = StageDisplayState.FULL_SCREEN

§ stage.displayState = StageDisplayState.FULL_SCREEN_INTERACTIVE

§ StageOrientationEvent:

stage.addEventListener(StageOrientationEvent.ORIENTATION_CHANGE, callbackFunction);

§ foo-app.xml:

<initialWindow>

<autoOrients>true</autoOrients>

Page 34: Flex 4.5 and mobile development

© 2010 Adobe Systems Incorporated. All Rights Reserved.

Camera Access

§ Camera - Raw camera feed

<uses-permission android:name="android.permission.CAMERA" />

<uses-feature android:name="android.hardware.camera" android:required="true"/>

<uses-feature android:name="android.hardware.camera.autofocus" android:required="false"/>

<uses-feature android:name="android.hardware.camera.&ash" android:required="false"/>

§ CameraUI - Native Camera App

var cameraUI:CameraUI = new CameraUI();

cameraUI.launch(MediaType.IMAGE);

§ CameraRoll - Choose photos from the device's camera roll

var cameraRoll:CameraRoll = new CameraRoll();

cameraRoll.browseForImage();

cameraRoll.addBitmapData(bd);

34

Page 35: Flex 4.5 and mobile development

© 2010 Adobe Systems Incorporated. All Rights Reserved.

Native App Integration

§ Open Email, Browser, Maps, Phone, or SMS

§ navigateToURL(new URLRequest('mailto:[email protected]'));

§ navigateToURL(new URLRequest('h$p://www.jamesward.com'));

§ navigateToURL(new URLRequest('h$p://maps.google.com/'));

§ navigateToURL(new URLRequest('tel:1234567890'));

§ navigateToURL(new URLRequest('sms:1234567890'));

35

Page 36: Flex 4.5 and mobile development

© 2010 Adobe Systems Incorporated. All Rights Reserved.

Local DB APIs

§ SQLite - Nothing different than AIR for the Desktop

§ SQLConnection

§ Sync and/or Async connections

§ SQLStatement

§ Prepared Statements:

var stmt:SQLStatement = new SQLStatement();

stmt.sqlConnection = FlexGlobals.topLevelApplication['sqlConnection'];

stmt.text = "INSERT into giberish values(:giberish)";

stmt.parameters[":giberish"] = g.text;

stmt.execute();

Page 37: Flex 4.5 and mobile development

© 2010 Adobe Systems Incorporated. All Rights Reserved.

StageWebView

§ Requires Android INTERNET permission:

<uses-permission android:name="android.permission.INTERNET" />

§ WebStageView.isSupported

var swv:StageWebView = new StageWebView();

swv.viewPort = new Rectangle(0, stage.height - height, width, height);

swv.stage = stage;

swv.loadURL("h$p://www.riagora.com");

37

Page 38: Flex 4.5 and mobile development

© 2011 Adobe Systems Incorporated.

Tablet and Enterprise applications

Camera

Microphone

GPS

3G

Mobility

Bright screen

Page 39: Flex 4.5 and mobile development

LiveCycle Collaboration Service

IN-CONTEXT COLLABORATION

Webcam Chat

SharedForm

Page 40: Flex 4.5 and mobile development

© 2010 Adobe Systems Incorporated. All Rights Reserved. Adobe Con!dential.

All external content and images pending approvals.

Multi-user collaboration in real time

LiveCycle Collaboration Service

Major CapabilitiesMajor Capabilities

Peer-to-peer (P2P) streaming of data, audio and video HTTP server-to-server APIsPrivate audio/video streaming Server-side provisioning of services

Large Rooms – via on-demand loading of user presence

Audio/video application multicast

Record and Playback Screen sharing

JavaScript APIs – integration with a customer’s existing websitesJavaScript APIs – integration with a customer’s existing websites

40

§ Engage more effectively through a web presence enhanced with real-time collaboration tools.

§ Integrate text chat, whiteboard functionality, webcam video, and audio into any rich Internet application (RIA),

Page 41: Flex 4.5 and mobile development

© 2011 Adobe Systems Incorporated. All Rights Reserved. Adobe Con!dential.

Michaël Chaize & resources : [email protected]

41

@mchaize

RIAgora.com Flex.orgdeveloper.adobe.com

Tour de Mobile Flex

Page 42: Flex 4.5 and mobile development

© 2011 Adobe Systems Incorporated. All Rights Reserved. Adobe Con!dential.