Cordova - Windows - Ecosystem

Jesse MacFadyen aka @purplecabbage

About Me

  • I've been working on Windows Phone 7 for over a year
  • More recently I have also been working on Windows Phone 8
  • I've been working on Windows 8 for a while too
  • I don't have a favorite color

About this presentation

This presentation is:

  • part marketing
  • part knowledge sharing
  • part opinion
  • part comedy (hopefully)
  • part propaganda
  • part wrong ( probably )

What is Windows?

Windows is an operating system.

Windows runs on computers collectively called 'PCs'

  • laptops
  • desktops
  • tablets

I make fun of this, because Mac seems to be over-represented in the tech community these days. IMHO

MacOS Only Platforms

  • iOS

Windows Only Platforms

  • Windows Phone 7
  • Windows Phone 8
  • Windows 8

Windows Phone 7

The first non-WebKit PhoneGap supported device


  • finally a standards compliant browser
  • developed in partnership with Microsoft
  • issues with touch+scrolling
  • no support for SVG, localStorage
  • isolated storage woes
  • elegant JS<=>C# communication

Windows Phone 7 Dev requirements

  • a windows machine
  • emulator does not work well in VMs
  • Visual Studio 2010 + Windows Phone 7 SDK
  • AppHub membership

Apache Cordova full API support, minus a few exceptions ...

The Windows Phone 7 Marketplace

  • interesting 'beta' functionality, up to 100 email addresses
  • developers were reporting consistent sales until the announcement of WP8

Windows Phone 8

Windows Phone 8

Cordova for WP8 was mostly implemented by Sergey and Ruslan

Microsoft supported development with access to devices, SDKs and technical expertise

Landing in 2.3.0 next week ( Mid December 2012 ), blog posts coming soon.

Windows Phone 8 Dev requirements

  • Windows 8 Pro or better, to develop ( 64 bit ONLY )
  • Emulator requires modern processor (Second Level Address Translation)
  • Visual Studio 2012 + Windows Phone 8 SDK
  • Emulator still does not work well in VMs (Hyper-V)

Apache Cordova full API support, minus a few exceptions ...

The new shiny

  • IE10
  • MSPointer events and NOT touch events.
  • no more need to unpack to IsolatedStorage
  • SVG Support
  • localStorage works when run from file://
  • webWorkers, page visibility, navigation timing, typed arrays, requestAnimationFrame, indexedDB, async script loading event

strict javascript

// Non-strict code...

  "use strict";

  // Define your library strictly...

// Non-strict code...

Windows Phone 8 HTML5 App Template

Microsoft actually documents how to communicate between JS + C#

The template has issues

The difference between Windows Phone 7 and 8

Windows Phone 8 devices run WP7 apps.

I actually recommend that developers stick to Cordova for Windows Phone 7 for now.

Permissions in Windows Phone 7 + 8

Windows Phone 7 + 8 both use static analysis.

There is also a permission manifest file.

This determines what permissions to list on your app store page

ie Why does this Todo-list app require access to my contacts, or camera, or my identity?

Cordova for Windows Phone 7 + 8 gets around this in a couple of ways :

  1. Do Nothing - Ignorance is bliss
  2. The 'Standalone' project - exclude
  3. Import just what you need

Windows 8

Windows Store Applications

Formerly known as 'Metro'

Windows 8

  • I started dev on my own, as a pet project
  • Intel's Open Source team was also interested, and started their own fork
  • I merged our repos, and switched to a support role, while Intel completed the implementation
  • docs are still in need of attention
  • command line tooling is non-existent

Microsoft Embraces the Cordova way

  • javascript becomes a first class citizen in Windows 8
  • cordova.js for windows 8 is a simple? translation layer
  • there are no contacts in Windows 8 ( the People app does that )
  • very cool binding of JS<=>C# and even JS<=>C++


extensive use of the Promise API from common JS
    .then(function () { return bAsync(); })
    .then(function () { return cAsync(); })
    .done(function () { finish(); });                        

A Promise Example

// Assign the URI to download from.
var uriExample = new Windows.Foundation.Uri("");
// Get the folder for temporary files.
var tempFolder = Windows.Storage.ApplicationData.current.temporaryFolder;

// Create the temp file asynchronously.
  function (tempFile) {
    // The createFileAsync call succeeded, so start the download operation.
    var downloader = new Windows.Networking.BackgroundTransfer.BackgroundDownloader();
    var transfer = downloader.createDownload(uriExample, tempFile);
    return transfer.startAsync(); 
  }).then(function (result) {
     //Define the function to use when the download completes successfully
     console.log("File download complete.");
  // Define the error handling function.
  function (error) {
    console.log("File download failed.");
  // Define the progress handling function.
  function (result) {
    console.log("Bytes retrieved: " + result.progress.bytesReceived);

The Windows Store

Developers are being strongly encouraged by Microsoft

  • The next gold-rush?
  • 40 million Windows 8 Licenses
  • 1500 different devices that run Windows 8

Windows 8 Permissions

Windows 8 uses a permission manifest to specify your permissions. This manifest determines what device APIs the browser exposes at runtime. Static analysis is not required.

Windows 8 Cordova pitfalls

utf-8 encoding of files MUST contain BOM

Our current nodejs based builder for cordova-js needs to take this into account ( open issue in JIRA )

The Cordova-Windows TODO grab-bag

  • not a roadmap, because the roads are not defined
  • not a list, because that implies order
  • just some things I hope to get to, or someone gets to


  • Evaluate the entire app submission process.
  • PhoneGap-Build integration?
  • Explore combining WP7+8 native codebase
  • CLI consistency
  • Distribute Nuget projects, from


... or is it?

Question Time