Developing for Multiple PlatformsUsing Web standards to efficiently target multiple devices
Dan PfeifferDeveloper at Float Mobile Learning@mediabounds
The Mobile LandscapeStatCounter; Mar-May 2011comScore; Mar 2011
The Mobile Landscape
PhoneGap
PhoneGap – Supported PlatformsAndroidBada*BlackBerry WebWorks (5.0 & 6.0)iOSSymbianwebOS
Write once—debug everywhere.
High percentage of code reuse
High percentage of code reuseFaster development time
High percentage of code reuseFaster development timeCheaper development
High percentage of code reuseFaster development timeCheaper developmentEasier to update
Forward compatibility
Limited by device’s browser engine
A Basic AppDemo
Performance
Performance & PerceptionUser expects immediate feedback to his/her interaction.
Performance & PerceptionUser expects immediate feedback to his/her interaction.There is a 400ms delay between user interaction and the `click` event.
Performance & PerceptionUser expects immediate feedback to his/her interaction.There is a 400ms delay between user interaction and the `click` event.Use touch events.
Performance & PerceptionDemo
Less PowerfulMobile devices are less lenient of inefficient code.
Less PowerfulMobile devices are less lenient of inefficient code.Inefficient code/processes manifest themselves in the user interface.
Reflow
ReflowThe cost of reflow is a major performance issue.
ReflowThe cost of reflow is a major performance issue.Simple way to reduce the cost of a reflow is to remove extraneous tags.
Watch for Extraneous Tags<ul>	<li><a href="#view1">View 1</a></li>	<li><a href="#view2">View 2</a></li>	<li><a href="#view3">View 3</a></li>	<li><a href="#view4">View 4</a></li></ul>
Watch for Extraneous Tags<ul>	<li><a href="#view1">View 1</a></li>	<li><a href="#view2">View 2</a></li>	<li><a href="#view3">View 3</a></li>	<li><a href="#view4">View 4</a></li></ul><a href="#image"><imgsrc="/some/image.jpg"></a>
ReflowSemantics takes a backseat to efficient HTML to reduce the cost of reflow.
JavaScript-based animation
JavaScript-based animationFor every frame!
CSS Transition/Animation
CSS AnimationDemo@-webkit-keyframesroll{from{-webkit-transform: translate3d(0px,0,0);}to{-webkit-transform: translate3d(200px,0,0) rotate(180deg);}}
PhoneGap API
PhoneGap APInavigator.camera.getPicture( cameraSuccess, cameraError, [ cameraOptions ] );
PhoneGap APIDemo
PhoneGap API
PhoneGap Plugins
DebuggingCheck your syntaxJS LintJS Hint
Debugging – Web InspectorDOMCSSJavaScript Console
Debugging - WEINREDemo<script src="http://localhost:8081/target/target-script-min.js#anonymous" type="text/javascript"></script>
Conclusion
Questions?www.floatlearning.com	@mediaboundsdpfeiffer@floatlearning.com
Resourceshttp://floatlearning.com/blog/http://phonegap.com/start/http://microjs.com/http://docs.phonegap.com/

Developing for Multiple Platforms

Editor's Notes

  • #3 Introduction – about me.Developer at FloatLots of experience in web developmentDegree from BradleyFollow: @mediaboundsLove coding!My beautiful fiancé
  • #4 The mobile landscape as it currently stands.Review market share of different OSes.Big players—you can assume your user is on one of these devices.
  • #5 “Native” language of each OS – “native” meaning the language that the SDK is written inLow percentage of reusable code – almost nil. (although you can use the same logic)Expensive to build for multiple platforms – not a great option to just build for one
  • #6 Introduce PhoneGapBuild your apps in HTML/CSS/JavaScript and wrap it in PhoneGap/PhoneGap exposes core features of the device as well as a plugin structure to communicate with the native code.
  • #7 Supports 6 different platformsBada is still under development—although I believe that it is available for use.Windows Mobile 7 is under development.
  • #8 Common workflow for Web developers.Take comfort in knowing that all 6 of the platforms I just mentioned run on some version of WebKit.Windows Mobile 7 runs at some Frankenstein combination of IE7/IE8
  • #10 Less code means less bugs.
  • #11 Less time means less money
  • #12 Every platform running on same code base.
  • #13 Web will always be relevantNew devices will have a browserBlackBerry is notorious for burning their developers with differences in the SDK…now for PlayBook you have to develop in Flash/Adobe AIR.
  • #17 Apple has set the bar on this one – when I touch the screen, something should happen immediately.
  • #19 WebKit providestouchstart/touchend events.
  • #21 It has less memory and less processing power
  • #27 This is not a “rule”; simply some guidance…some things to look out for.
  • #28 Especially true forPhoneGap apps—you’ll have to weigh the pros and cons for a mobile website.In addition to reducing the cost of a reflow, we need to reduce the number of times a reflow occurs.
  • #31 CSS transitions/animations work directly on the paint layer
  • #33 PhoneGap exposes some common features of the device to your mobile web app—gives you a leg up on a simple web page.