Setting up Apache Cordova for cross-platform mobile development – Part 2 – Windows

This article is the second in a series that will cover the steps to set up Apache Cordova for the Android, Windows and iOS platforms.

See the full list of platforms supported by Apache Cordova here.

Hello, Windows

In this article I’ll create a Windows Store App with the same Apache Cordova project I created in numero uno of this series.

Let’s get started!

  1. Install the Windows SDK for Windows 8.

I’m using Visual Studio 2013 with the Windows 8.1 SDK on a Windows 8.1 machine, and I did not have the Windows 8 SDK installed. I soon saw my Cordova Windows app target failing to build with an obscure message. I learned that at the time of this writing, Cordova needs the Windows 8 SDK, or it will not be able to compile your Windows app even if you already have the Windows 8.1 SDK installed.

  1. Add the Windows target to our HelloCordova app and build it:

cordova platform add windows

To see what platforms you have already added use:

cordova platform ls

or simply

cordova platform

Now build the Windows target with:

cordova build windows

Add and build a Windows target
Add and build a Windows target
  1. It’s that simple! Run the app!

cordova run windows

Since this is a Windows Store App, you will be prompted to acquire a Windows 8.1 developer license and a signing certificate. Microsoft has made this a simple once-a-month process and it’s free!

Renew the developer license
Renew the developer license
Install the certificate
Install the certificate

Cordova will be able to install and launch your app after the signed Windows Store App (with an .appx extension) is created.

This is our HelloCordova app on Windows 8.1 in it’s full-screen awesomeness.

Apache Cordova Windows Store App
Apache Cordova Windows Store App

You can even search for it in the Apps listing.

Apache Cordova Windows Store App in the Apps list
Apache Cordova Windows Store App in the Apps list

And here it is side-by-side along with my desktop.

Notice how the app has adapted to the change from full-screen mode.

Apache Cordova Windows Store App resized
Apache Cordova Windows Store App resized

When Windows 10 arrives, this Store App will exist on your desktop, just like any other Windows app.

So now, our HelloCordova project targets Windows and Android with the same code! Awesome!

Go forth and write responsive cross-platform apps!

I hope you enjoyed this article. Please leave me a note if you found it useful.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s