Top Banner
Developing cross-platform mobile applications with PhoneGap @ColinEberhardt
24

Developing cross platform mobile applications with phone gap for windows phone

May 09, 2015

Download

Technology

Colin Eberhardt
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: Developing cross platform mobile applications with phone gap for windows phone

Developing cross-platform mobile applications with

PhoneGap 

@ColinEberhardt

Page 2: Developing cross platform mobile applications with phone gap for windows phone

Why cross-platform?Introduction to PhoneGap

PhoneGap APIs, History of PhoneGap WP7

A simple PhoneGap applicationHow PhoneGap works

A more complex applicationKnockoutJS – MVVM, Property FinderiOS ‘view’

Is PhoneGap a viable approach?

Overview

Page 3: Developing cross platform mobile applications with phone gap for windows phone

Why cross platform?

http://bit.ly/gartner-wp7-share

Page 4: Developing cross platform mobile applications with phone gap for windows phone

Rewrite for each platform

Page 5: Developing cross platform mobile applications with phone gap for windows phone

What is PhoneGap?

HTML / JavaScript

Application

Phon

e AP

IsPh

one

APIs

Page 6: Developing cross platform mobile applications with phone gap for windows phone

AccelerometerCompassCameraCaptureConnectionContactsDevice

PhoneGap APIs

EventsFileGeolocationMediaNotificationStorage

Page 7: Developing cross platform mobile applications with phone gap for windows phone

PhoneGap, first stable release, Feb 2009Matt Lacey, August 2010, initial implementationPhoneGap for WP7 beta, Sept 2011Mango roll-out, Oct 2011Adobe acquires Nitobi, Oct 2011Property Finder enters Marketplace, Nov 2011

http://bit.ly/property-finder

WP7 fully supported, Jan 2012

PhoneGap for Windows Phone 7

Page 8: Developing cross platform mobile applications with phone gap for windows phone

Our first PhoneGap app

PhoneGap application template

Overview of the various files‘www’ folder - HTML / JS / image assetsGapSourceDictionary.xmlRegular WP7 Silverlight files

Simple modificationRead accelerometer data

Page 9: Developing cross platform mobile applications with phone gap for windows phone

How does it work?

acc.getCurrentPosition()

window.external.Notify()

PhoneGap C# code Acceleromete

r

getAcceleration()

DispatchResult()

ScriptNotify()

PhoneGap JavaScript

Page 10: Developing cross platform mobile applications with phone gap for windows phone

Multi-page applicationsSeparate HTML pagesJavaScript re-loaded between each pageNo state transferred from page-to-pageBack-button handling required

http://bit.ly/wp7-multipage-phonegap

Single-page applicationsPage updates as application state changes

‘think’ GMail

Applications styles

Page 11: Developing cross platform mobile applications with phone gap for windows phone

Twitter Search

http://knockoutjs.com/

Demo running FireFoxBack-button handling

Page 12: Developing cross platform mobile applications with phone gap for windows phone

CSS StylingDoes not support pressed state

Disable pinch / tap zoomRequires some ‘hacking’http://bit.ly/suppress-pinch

Gray highlightYou’re stuck with it!

Native look and feel

Page 13: Developing cross platform mobile applications with phone gap for windows phone

ProsMuch better than the pre-mango!http://bit.ly/ie9-mobile-features

Canvas, video, audioMany CSS3 features

ConsA lack of touch eventsThe ‘gray link’ issue

http://bit.ly/stackoverflow-gray-highlight

The WP7 IE9 browser

Page 14: Developing cross platform mobile applications with phone gap for windows phone

Property Finder (video)

The first HTML5-based WP7 app (I think!)Uncovered a few PhoneGap issues!

Page 15: Developing cross platform mobile applications with phone gap for windows phone

Knockout JS enables the use of MVVMThe ‘view’ code is currently WP7 specificFor iOS use a different view

http://jquerymobile.com/

Cross platform?

Page 16: Developing cross platform mobile applications with phone gap for windows phone

Property Finder iOS

Page 17: Developing cross platform mobile applications with phone gap for windows phone

PhoneGap Build

Page 18: Developing cross platform mobile applications with phone gap for windows phone

Property Finder iOS (video)

Page 19: Developing cross platform mobile applications with phone gap for windows phone

Set-up cost is lowPhoneGap build removes the need for a MacBrowser-based testing

Browser specific JavaScript / CSS codeOften handled by existing JavaScript librariesMore required if you want to have a native ‘feel’

Currently most people roll-out an iOS look to Android

WP7 IE9 browser is _almost_ good enoughWebkit browsers also have major flaws – overflow:scroll

Is PhoneGap a viable approach?

Page 20: Developing cross platform mobile applications with phone gap for windows phone

Is PhoneGap a viable approach?

Create an application with its own identity

Page 21: Developing cross platform mobile applications with phone gap for windows phone

JavaScript is ubiquitousRe-use code for a Windows 8 Metro AppRe-use code for web-app

JavaScript is relatively future proof

Offline applicationsUses the HTML5 app-cache

The FT iPad application is a good example

Frees you from the marketplace

The JavaScript advantage

Page 22: Developing cross platform mobile applications with phone gap for windows phone

It depends!Project budgetNumber of platforms targetedRichness of content being deliveredWillingness to depart from native UIs

Would I use it? Or go native?

Page 23: Developing cross platform mobile applications with phone gap for windows phone

MonoTouchC# with bindings to native controlshttp://xamarin.com/monotouch

Appcelerator TitaniumPreviously ran JavaScript in browser, now compiles to nativehttp://www.appcelerator.com/

Adobe Mobile AirAS3 running within the Air runtimehttp://www.adobe.com/products/air.html

PhoneGap alternatives

Page 24: Developing cross platform mobile applications with phone gap for windows phone

Questions?

Image credit: Lattice by ColinBroug (http://www.sxc.hu/photo/1359433)