Dr. Dobb's is part of the Informa Tech Division of Informa PLC

This site is operated by a business or businesses owned by Informa PLC and all copyright resides with them. Informa PLC's registered office is 5 Howick Place, London SW1P 1WG. Registered in England and Wales. Number 8860726.

Channels ▼


Windows Phone 8 App Development: Getting Started

I highly recommended that you install Visual Studio 2012 Update 3 if you still haven't done so. Start Visual Studio 2012, select TOOLS | Extensions and Updates… and then click Updates | Product Updates. The Extensions and Updates dialog box will display Visual Studio 2012 Update 3 with an Update button on the right-hand side (Figure 5). Click on Update and you will have Visual Studio 2012 with Windows Phone SDK 8.0 and the latest update. I'll assume you have this Update installed.

Windows Phone App Development
Figure 5: Visual Studio 2012 Update 3 displayed in the Extensions and Updates dialog box.

Windows Phone 8 App Types

When developing apps for Windows Phone 7.x, there were two different worlds: Silverlight and XNA. When you target Windows Phone 8, you have the following choices for the UI framework:

  • XAML
  • Mixed mode XAML and Direct3D
  • Direct3D

You can think of XAML apps as the new version of Silverlight for Windows Phone apps. In fact, you will be able to reuse most of your existing knowledge of Silverlight for Windows Phone in XAML apps that target Windows Phone 8. If you feel more comfortable with HTML5 and CSS, there is a Windows Phone HTML5 app project template that enables you to easily create an app that displays HTML5 pages. The project template is available for both Visual Basic and C# languages, but it includes XAML pages and managed code. Thus, you cannot consider the project a pure HTML5 solution.

You can use both C# and Visual Basic to create Windows Phone 8 apps and interact with .NET for Windows Phone, the Windows Phone runtime, and Direct3D in mixed mode with XAML. Windows Phone 8 has discontinued the XNA app model,so you won't be able to create XNA games if you want to target Windows Phone 8. Direct3D has replaced XNA. However, Windows Phone 8 can run existing XNA games and the project templates include XNA for backward compatibility with Windows Phone 7.x.

Windows Phone 8 includes support for native code development with C++ (Figure 6). Native code development is very useful for games that require the best performance and use Direct3D. However, as happens in other mobile platforms, it is also possible to create runtime components and libraries that take advantage of the higher performance of native code but can be consumed in managed code apps. The latest Visual Studio 2012 updates added the Windows Phone Unit Test App to simplify testing.

Windows Phone App Development
Figure 6: Windows Phone 8 project templates for C++ (native code).

Windows Phone 8 uses the Windows Phone Application Store as the main mechanism for distributing apps. The Store was formerly known as the "Windows Phone Application Marketplace." However, the Store isn't an appropriate source for distributing enterprise apps, so Windows Phone 8 includes additional ways of distributing apps to solve this issue:

  • Internet or Intranet downloads through Internet Explorer on Windows Phone 8.
  • Email attachments.
  • Loaded on a microSD card that then is inserted into the phone.

Performance Improvements for Apps and Background Tasks

Windows Phone 8 made a big change in the process of submitting an app to the Windows Phone Application Store. When you submit, the process precompiles the app for the ARM CPU that powers Windows Phone devices. This way, when the end user downloads the apps from the Store, the app package includes ARM code that doesn't require the Just-In-Time (JIT) compiler, thus removing overhead, which translates into faster startup times for the apps and better performance. In addition, the removal of the JIT compiler overhead improves battery life.

Background execution is one of the biggest problems for mobile devices because apps with background execution are often reduce of battery life. The Windows Phone 8 UX motivates apps to provide live tiles, and users usually expect apps to continue providing information even when they aren't interacting with them. An app running unconstrained tasks in the background can detrimentally affect the performance of the other apps running on the phone and reduce battery life. So Windows Phone 8 provides background services that permits developers to perform common tasks on behalf of the apps in an efficient way.

The Background Transfer Service enables apps to perform HTTP transfers that keep the necessary balance to avoid having a negative impact on network traffic for the main foreground app. The Alarms API, for example, allows apps to create reminders without having to write code that runs in the background to keep track of time. This way, the apps that require reminders use the services provided by the Alarms API and don't need to reinvent the wheel to create efficient background mechanisms.

The Windows Phone 8 project templates for managed code include the following three scenario-based agents that you can use for common background tasks:

  • Windows Phone Audio Playback Agent
  • Windows Phone Audio Streaming Agent
  • Windows Phone Scheduled Task Agent

If your app requires audio playback, you create an agent based on the Windows Phone Audio Playback Agent and you benefit from reusing the existing infrastructure for playing and controlling background audio. This way, Windows Phone 8 makes sure your app doesn't consume unnecessary additional resources simply to play audio.

You will use the Windows Phone Scheduled Task Agent when you need to perform either a periodic or a resource-intensive task. For example, when you have an app that needs to regularly fetch the latest news to update the app tiles, you just need to create and consume a Windows Phone Scheduled Task Agent to perform that task.

As happens with Windows 8 apps, Windows Phone 8 managed code apps with .NET for Windows Phone and the Windows Phone runtime also trust in the new asynchronous programming model to avoid blocking the UI. Thus, asynchronous methods are an essential part of Windows Phone 8 manage code apps. If you aren't familiar with the new async and await modifiers that are part of C# 5.0, have a look at "Using Asynchronous Methods in ASP.NET 4.5 and in MVC 4" before attempting Windows Phone 8 managed code app development with XAML and .NET. The article talks about ASP.NET 4.5 and MVC 4, but the explanations for asynchronous methods are also useful for Windows Phone 8 app development. In the next article in this tutorial, I will be using asynchronous methods to interact with the different speech APIs.

Portable Class Libraries and Windows Phone 8

One last point before wrapping up: If you want to share code between Windows Phone 8 apps and other Microsoft platforms, after you have installed the Windows Phone SDK 8.0, you will be able to add Windows Phone 8 as one of the target frameworks for Portable Class Libraries (see Figure 7).

Windows Phone App Development
Figure 7: Windows Phone 8 as one of the targets for a Portable Class Library.

If you want more information about the benefits of Portable Class Libraries to share code between multiple Microsoft platforms, you can read "Access Data with REST in Windows 8 Apps." Note that you can also consume the Portable Class Libraries in Windows Phone 8 apps.

In this article, I've put in place the resources you need to develop apps for Windows Phone 8. I've provided a brief overview of some of the most important things that you must consider before starting your adventures in Windows Phone 8. In the next article, I'll explain how to develop apps that take advantage of the new features related to the speech APIs: Voice Commands, Speech Synthesis, and Speech Recognition.

Gaston Hillar is a frequent contributor to Dr. Dobb's.

Related Articles

Windows Phone 8 App Development: Using Voice Commands

Using Speech APIs in Windows Phone 8

Related Reading

More Insights

Currently we allow the following HTML tags in comments:

Single tags

These tags can be used alone and don't need an ending tag.

<br> Defines a single line break

<hr> Defines a horizontal line

Matching tags

These require an ending tag - e.g. <i>italic text</i>

<a> Defines an anchor

<b> Defines bold text

<big> Defines big text

<blockquote> Defines a long quotation

<caption> Defines a table caption

<cite> Defines a citation

<code> Defines computer code text

<em> Defines emphasized text

<fieldset> Defines a border around elements in a form

<h1> This is heading 1

<h2> This is heading 2

<h3> This is heading 3

<h4> This is heading 4

<h5> This is heading 5

<h6> This is heading 6

<i> Defines italic text

<p> Defines a paragraph

<pre> Defines preformatted text

<q> Defines a short quotation

<samp> Defines sample computer code text

<small> Defines small text

<span> Defines a section in a document

<s> Defines strikethrough text

<strike> Defines strikethrough text

<strong> Defines strong text

<sub> Defines subscripted text

<sup> Defines superscripted text

<u> Defines underlined text

Dr. Dobb's encourages readers to engage in spirited, healthy debate, including taking us to task. However, Dr. Dobb's moderates all comments posted to our site, and reserves the right to modify or remove any content that it determines to be derogatory, offensive, inflammatory, vulgar, irrelevant/off-topic, racist or obvious marketing or spam. Dr. Dobb's further reserves the right to disable the profile of any commenter participating in said activities.

Disqus Tips To upload an avatar photo, first complete your Disqus profile. | View the list of supported HTML tags you can use to style comments. | Please read our commenting policy.