I first learned about developing for Windows Phone 7 at this spring’s MIX 10 conference in Las Vegas, and I wanted to share my thoughts. As a developer, I’m excited about the Windows Phone 7 mobile application platform because it allows people like me, C# and Silverlight developers, to quickly become productive and start building Windows Phone 7 applications. I can immediately use my existing skills and tool knowledge. Plus, my code will run on multiple platforms, including the phone, the web, the PC and Xbox. This ability to re-use code means my apps can potentially reach millions of customers through the Windows Phone 7 Marketplace. Let me take you through the aspects of this new development platform that I think will help you get started.
New Capabilities and UI
Windows Phone is a new start for Microsoft phone software. Its “3 screens + cloud” (i.e., PC, phone, TV plus Internet) application platform lets you create cloud-powered user experiences. Microsoft offers the ability to develop applications that can run on a variety of devices, including desktop computers, phones, and Xbox consoles.
Windows 7 Phone’s design system theme means that you can design integrated user experiences that deliver high performance. The programming API lets you create intuitive applications. For example, if you want to add a textbox that expects a certain type of input, such as a URL or a phone number, you can specify that the phone automatically change keyboard layout to make the expected characters easily accessible:
<InputScopeName NameValue="Url" />
Windows Phone 7 offers two types of UI framework: The Silverlight framework (for details, see) lets you quickly create rich and highly interactive applications, and the XNA framework is the platform for high-performance applications such as 2D and 3D games. Applications developed in either UI framework can include input capture through touch or hardware buttons, media capture and playback, access to isolated data storage through Language-Integrated Query (LINQ), access to phone functionality, and access to cloud-based services, such as Microsoft Windows Azure.
Azure-based cloud services provide application deployment and update capabilities, notification services, identity services, location services, maps, and Xbox Live integration. These services are what lets end users share their information across all of their own devices (multiple phones, Xbox, etc.), as well as with other users.
Location services are particularly interesting because the framework gets location from the current location provider (GPS, WiFi, or wireless network), depending on how accurate you need the location data to be. (For more information, see How to: Get Data from the Location Service.)
For example, if you needed high accuracy location data that is updated every time the device is moved by 20 meters, you can use the following code:
GeoCoordinateWatcher watcher = new GeoCoordinateWatcher(GeoPositionAccuracy.High);
watcher.MovementThreshold = 20;
void watcher_PositionChanged(object sender, GeoPositionChangedEventArgs<GeoCoordinate> e)
Deployment.Current.Dispatcher.BeginInvoke(() => MyPositionChanged(e));
void MyPositionChanged(GeoPositionChangedEventArgs<GeoCoordinate> e)
LatitudeTextBlock.Text = e.Position.Location.Latitude.ToString("0.000");
LongitudeTextBlock.Text = e.Position.Location.Longitude.ToString("0.000");
Multitouch input is one of the biggest selling points of modern phones. Here’s how you can process multitouch events in Windows Phone 7 using Manipulation Events. Suppose that you have a plain Windows Phone page with one rectangle:
Fill="Blue" Stroke="Blue" StrokeThickness="1" />
You would then hook up the ManipulateDelta event handler as shown below:
private TransformGroup transformGroup;
private TranslateTransform translation;
private ScaleTransform scale;
this.ManipulationDelta += this.PhoneApplicationPage_ManipulationDelta;
this.transformGroup = new TransformGroup();
this.translation = new TranslateTransform();
this.scale = new ScaleTransform();
this.rectangle.RenderTransform = this.transformGroup;
void PhoneApplicationPage_ManipulationDelta(object sender, ManipulationDeltaEventArgs e)
this.scale.ScaleX *= e.DeltaManipulation.Scale.X;
this.scale.ScaleY *= e.DeltaManipulation.Scale.Y;
this.translation.X += e.DeltaManipulation.Translation.X;
this.translation.Y += e.DeltaManipulation.Translation.Y;
When you run this code, you can move the rectangle on the screen. If your development computer supports multitouch or if you deploy to the actual device, you can also resize the rectangle using two fingers.
Runtime API and Hardware
Windows Phone 7’s runtime API set lets you develop user experiences that are consistent with the overall UI theme. These APIs give you access to hardware features such as sensors, photo and video media, cameras, phone services, location services, and notification services.
The Windows Phone 7 hardware specification prescribes minimum hardware requirements that device manufacturers have to support. For example, all phones have to provide a 5MP camera with flash, four or more touch points, and DirectX 9 hardware acceleration. Devices have to support screen resolution of either 480 x 320 or 800 x 480. The hardware spec assures you that key hardware functions will be available across all devices in a consistent way through the phone’s runtime API. For example, this is how you can gain access to the accelerometer sensor (click here for more information Accelerometer Overview for Windows Phone 7) and display information about orientation of the phone:
AccelerometerSensor accelerometer = AccelerometerSensor.Default;
void accelerometer_ReadingChanged(object sender, AccelerometerReadingAsyncEventArgs e)
Deployment.Current.Dispatcher.BeginInvoke(() => MyReadingChanged(e));
void MyReadingChanged(AccelerometerReadingAsyncEventArgs e)
statusTextBlock.Text = accelerometer.State.ToString();
XTextBlock.Text = e.Value.Value.X.ToString("0.00");
YTextBlock.Text = e.Value.Value.Y.ToString("0.00");
ZTextBlock.Text = e.Value.Value.Z.ToString("0.00");
For details on the accelerometer, you can click here: Accelerometer Overview for Windows Phone
To start developing Windows Phone 7 applications, you will need the Windows Phone Developer Tools. As part of the tool, you get Visual Studio 2010 Express for Windows Phone or the Windows Phone Add-in for Visual Studio if you already have Visual Studio 2010. You’ll also want Expression Blend 4, and XNA Game Studio if you want to write XNA-based applications. (Learn more at Create Your first XNA Application for Windows Phone.)
These tools are available from the Microsoft Web site at this link. In addition, you can download free developer tools that give you the device emulator and Visual Studio project templates.
Design and develop your application as you would any Silverlight application. Then test it on the emulator or deploy it to a test device.
When you finish your application, you package it in a .xap application package file. It contains everything the application needs to run—the application itself, metadata describing how the application uses the target phone device, the tile that appears on the start screen, the application icon, and licensing terms.
Making Your Application Available
Before you can make your application available to others, you need to register for Developer Portal Services. You will need to sign in with your Windows Live ID and establish your identity as a Windows Phone application developer. You’ll provide a certificate that will be used to sign applications before they’re available on the Windows Phone marketplace. The Developer Portal also provides management, billing, and reporting tools so you can find out what your application’s users are doing with it and how much money you’ve earned.
Once you’ve packaged and signed you application, you submit it to the Developer Portal for certification. This process will verify that the application is compliant with laws and regulations of the target markets, does not misuse users’ information that is stored on the phone, and is generally well-behaved (e.g., does not utilize CPU cycles excessively and drain the battery, does not interfere with core functionality of the phone devices, such as the ability to make calls).
How do you get paid? You may choose to create free, paid, or “freemium” (try before you buy) applications. You determine the fee structure on the developer portal when you publish your application. End users can pay either by credit card or through mobile operator billing. Application developers keep 70 percent of the revenue.
Through the Marketplace you can deploy application updates that will be automatically rolled out to your users. Whenever updates are available, users are notified and asked if they want to apply the updates to their devices.
The Windows Phone 7 looks like an exciting platform to develop on. You can use the skills and tools you already have, but you can also get creative and make some money on the applications you develop. Microsoft has provided an environment that takes you from coding to making your application available for purchase, to tracking usage, to providing updates.
For details on how to develop for the Windows Phone 7, Microsoft provides numerous resources. To get going, check out the resources listed below.
Karen Forster is Vice President of Platform Vision, www.platformvision.com, and is responsible for building a community around IT decision-making from a platform perspective. She has more than 20 years’ experience in media, publishing, and technology. In 1996, moving from an IBM Midrange computing magazine, Karen took the editorial lead on the start-up Windows NT Magazine (now Windows IT Pro) and its associated web sites and online publications, including newsletters on topics such as Exchange, scripting, security, and IIS. Karen launched SQL Server Magazine in 1999. In 2002, Microsoft recruited Karen to serve as Director of Windows Server User Assistance, bringing her from Colorado to the Seattle area.
Karen has a degree in general linguistics and English as a foreign language from the University of Regensburg, Germany. She lived and worked in Germany for 9 years and returns to visit in-laws frequently. Karen is always interested in hearing about gemuetliche beer gardens in Bavaria.