Wednesday, August 21, 2013

Getting Started with Mobility, Part 4: Native Windows Phone

In this series, we're introducing mobile development by looking at a variety of platforms. In Part 1, we provided an overview of the mobile landscape, and in Parts 2 and 3 we examined native iOS and Android development. Here in Part 4, we'll introduce you to native development for Windows Phone.

Windows Phone, Microsoft's Smartphone Platform
Windows Phone isn't the dominant player in the mobile market, but it's still worth developing for, especially if you're looking to have good coverage across mobile platforms. Windows Phone devices are a favorite of many businesspeople who rely on its mail and calendar functionality. When Microsoft replaced the former Windows Mobile with the new design of Windows Phone, it was a huge improvement; and the latest update, Windows Phone 8, improves things even more. Some of the key factors emphasized in Windows Phone include ease of access (pinning anything important to you to the start screen), hubs for content important to you such as people, games, and music; cloud sharing and backup via SkyDrive; and deluxe cameras and photo sharing.

Microsoft is busy transforming itself into a devices and services company, and one of the outpourings of that is convergence across their products and services. You'll find increasing similarities between design and development for Windows Phone, Windows 8 on tablets and PCs, and XBox, with Cloud-based services providing a unifying layer that allows users to comfortably move among multiple devices seamlessly.

Like Google, Microsoft works with multiple manufacturers and carriers, giving customers a lot of choice in Windows Phone devices.

Windows Phone: A Variety of Devices and Carriers

The Computer You'll Develop on: A Windows PC
Windows Phone development is done a PC. If you happen to use a Mac, you'll need to run a Windows VM in order to do Windows Phone development.

Developer Tools: Visual Studio and the Windows Phone SDK
For development, you'll need Visual Studio and the Windows Phone SDK. Although Visual Studio is a commercial product, there is a Visual Studio Express edition for Windows Phone available which is free.

Visual Studio is a mature development environment, familiar to anyone who writes code for the Microsoft mobile, web, desktop, server, or cloud platforms. For Windows Phone 8 development, Visual Studio 2012 provides a good spectrum of project templates for everything from media streaming apps to games.

Visual Studio IDE

Another tool you'll want to consider is Microsoft Expression Blend. Blend will help you develop your user interface with professional tooling rather than having to code your XAML markup directly.

Microsoft Expression Blend

Programming: XAML and C#
Typically, you'll do your Windows Phone development in Microsoft's C# language and express your screens in a markup language named XAML. It is also possible to write some or all of your app in C++, which you might choose to do for performance reasons for certain kinds of apps. You can also leverage Microsoft's XNA Game Studio and Direct3D graphics engines for your Windows Phone apps.

Here's what a Windows Phone screen definition looks like in XAML:

<!--ContentPanel - place additional content here-->
<Grid x:Name="ContentPanel" Grid.Row="1" Margin="12,0,12,0">
  <TextBox x:Name="URL" Margin="10,10,85,0" Text=
  <Button x:Name="Go" Content="Go" HorizontalAlignment="Right"
          Margin="346,10,0,0" VerticalAlignment="Top"/>
  <phone:WebBrowser x:Name="MiniBrowser" Margin="10,82,0,0"/>

You'll write code in C#. Here's an example of C# that goes with the above XAML screen:

using System;
using Microsoft.Phone.Shell;
using MiniBrowser.Resources;
namespace MiniBrowser
    public partial class MainPage : PhoneApplicationPage
        // Constructor
        public MainPage()

        private void Go_Click(object sender, RoutedEventArgs e)
            string site = URL.Text; MiniBrowser.Navigate(

                new Uri(site, UriKind.Absolute));

C# is a popular and effective language to develop in. Like Java it features garbage collection so you won't have to work with pointers or be overly concerned about memory management.

Testing Your Apps: The Windows Phone Emulator
The Windows Phone SDK provides an emulator for Windows Phone. You can test your apps on the emulator or an actual Windows Phone device as you prefer.

Selecting Emulator or Device in Visual Studio

Windows Phone Emulator

Online Resources
Like most mobile platforms, Microsoft provides a comprehensive developer center, found at Here you'll find design guidance, developer resources, training, community forums, and store management. You'll want to begin with Getting started with developing for Windows Phone.

Here are some key online resources you'll want to get familiar with:
Design Principles
Publishing your App
Sample Code

Windows Phone tutorials are available in a number of places. In addition to free and paid materials available from Microsoft, along with occasional developer events in your area, you may also want to consider third-party materials such as Pluralsight video training courses.

1. How to create your first app for Windows Phone

This first tutorial shows you how to develop a simple initial app, a Mini Browser. You'll design a simple screen in XAML and implement C# code to go with it.
Mini Browser App

After this initial tutorial, most of the learning materials available to you are in the form of video tutorials. You may find it useful to also get familiar with some of the sample code projects available.

2. Building Apps for Windows Phone 8 Jump Start

Microsoft Virtual Academy provides a video series on getting started with Windows Phone 8 development. Topics covered include:

• Introducing Windows Phone 8 Development
• Designing Windows Phone 8 Apps
• Building Windows Phone 8 Apps
• Files and Storage on Windows Phone 8
• Windows Phone 8 Application Lifecycle
• Background Agents
• Tiles and Lock Screen Notifications
• Push Notifications
• Using Phone Resources in Windows Phone 8
• App to App Communication in Windows Phone 8
• Network Communication in Windows Phone 8
• Proximity Sensors in Windows Phone 8
• Speech Input in Windows Phone 8
• Maps and Location in Windows Phone 8
• Wallet Support
• In-App Purchasing
• The Windows Phone Store
• Enterprise App Architecture
• Windows 8 Cross-Platform Development
• Mobile Web

3. Windows Phone Design Bootcamp

These videos will acquaint you with the philosophies of Windows Phone Design Language and the design process.

4. Microsoft Learning Courses and Exams

Microsoft Learning offers paid online courses on Windows Phone and certification exams to demonstrate your expertise.

Summary: Native Windows Phone Development
It's easy to get started with Windows Phone development, especially if you have previously done any work with Microsoft .NET, C#, Silverlight, or Windows Presentation Foundation--you'll be in familiar territory.

Next: Getting Started with Mobility, Part 5: Native Windows 8

No comments: