In-Depth
Windows Phone 7: Mobilizing .NET Developers
Will familiar tools and a low barrier to entry entice you to build innovative apps for Windows Phone 7?
In a bold move, Microsoft is breaking from its native Windows Mobile stack and introducing a managed API platform for developers. Developers can use this platform to start building third-party mobile apps that run on Microsoft Windows Phone OS 7.0 devices, which are expected at retail in September. But can a brand-new mobile platform fueled by killer apps help Microsoft restore its footing against the Apple iPhone and the Google open source Android platform in the fast-paced global smartphone market?
"It's not so much that Microsoft has finally begun to fill the gaps in its offering compared with its key rivals such as Apple and Google," said research firm Ovum's Tony Cripps in an analyst note when Windows Phone 7 (WP7) was introduced in February at the Mobile World Congress. "It's more that the company is making its core competence -- namely software development and expertise -- work for it in the form of a leverageable and scalable basis for multichannel content and services."
The company's new line of attack rests on driving .NET developers and designers to use familiar tools and skill sets to build WP7 apps for a consumer marketplace. The WP7 application development platform is based on the Microsoft rich Internet application framework Silverlight, its gaming framework XNA and the .NET Compact Framework for micro devices. In February, Microsoft announced the XNA Framework -- which is used to build Xbox 360, Windows PC and Zune apps -- now supports Windows Phone and Silverlight.
Microsoft is also leveraging its consumer-focused product channels and services by integrating Zune Media, Xbox Live and Windows Azure cloud services, a major focus throughout all of its products going forward. The Windows Phone System Design, which is code-named "Metro" for its allegiance to international signage in a clean layout with an original typeface, is closer to the Microsoft media player Zune HD than Windows.
WP7 applications will be distributed through the Windows Phone Marketplace -- accessible via an integrated "hub" on all WP7 devices -- and through desktop PCs. In a model that's similar to the Apple App Store, developers can monetize their apps and earn up to 70 percent of revenues from applications that pass the Microsoft certification requirements.
Consumer-First
In a move that surprised Windows Mobile developers, the WP7 platform is a clean break from the company's longstanding platform, which Microsoft says it will still support. The change in strategy leaves Windows Mobile developers, many of whom had focused on business apps, with some tough decisions to make, and no upgrade path.
"We've always been very strong supporters of Windows Mobile platforms," says Ellen Craw, president of Ilium Software Inc. "And we believe that Microsoft made the right decision about backward compatibility -- but we also have to be realistic about what we can do and what we believe will pay off."
Microsoft's strategy centers on a new market that it identifies as "life maximizers." "We're building this phone with a focus on the end user," says Charlie Kindel, manager of the Microsoft Windows Phone Application Platform and Developer Experience program. "They use their phone at home, but they also use their phone in work situations and the phone needs to be great at both, so there absolutely is an enterprise story as part of Windows Phone 7 Series," he explains.
WP7 features an Office hub with Excel, Word, OneNote, SharePoint integration and networking in Silverlight, with Windows Communication Foundation (WCF), HttpWebRequest and WebClient.
The user's personalized content on the phone drives the contextual experience, from live dynamic tiles on the Start screen to task--oriented hubs that offer a wider-than-the-screen panoramic view. Developers can build apps that take up a single screen, plug in to a Windows Phone app like the photo editor, or build hub-based panoramic experiences.
"As a developer, it's going to be possible to create apps that integrate with the phone's UI," says Brad Becker, director of product management for rich client platforms at Microsoft. "You'll be able to create apps that look and feel like the Windows Phone apps that come in the box, but you'll also be able to go away from that. If you want to build a video game that's full screen and doesn't use any of the look-and-feel of Windows Phone, you can certainly do that as well."
Microsoft is trying to ensure a consistent user experience for end users on both the hardware and software platforms. The WP7 devices, despite having different manufacturers, will all use an ARMv7 architecture with Cortex/Scorpion processor (or better) from Qualcomm Inc., a unified graphics subsystem (DirectX9), only two screen sizes and support capacitive touchscreens with four contact points. Other hardware specifications include 256MB RAM, 8GB Flash and a 5MP camera. First-generation WP7 devices will ship with a 800x480 WVGA touchscreen, with 480x320 HVGA expected sometime after the launch. When the second resolution is shipped, application and game developers will be expected to support both, according to Kindel.
WP7 supports standard phone-specific functionality and sensors that developers can tap into, such as location (Wi-Fi, cellular and GPS) and map control (Bing), compass, light proximity and accelerometer and push notifications. The location API works with Windows Azure cloud services.
Despite the uniformity, WP7 devices will be available in different form factors; so far three prototypes have been shown. Chassis 1 is the ASUS phone used in engineering and demos by Microsoft with the onscreen keyboard. A second design is a sliding QWERTY keyboard by LG Electronics; the third is the Samsung slab-style phone.
"I don't think these are final representations," says Kindel. "We're [giving] our manufacturers a great deal of flexibility in the look and feel of the phone. We think there's going to be a lot of innovation and industrial designs that are going to be available between now and the foreseeable future."
The hardware specifications, Windows Phone System Design and application platform should make app development easier for mobile developers who can count on consistent experiences for end users, says Microsoft. In the past, Windows Mobile developers had to deal with limited or non-existent support of various functionality based on the OEM or even different products from the same manufacturer.
Getting Started
All WP7 development tools are free and will remain free for Windows Phone developers. Developers can register for the free tools with their Windows Live ID.
The Windows Phone Developer Tools CTP, released at MIX10, supports the Visual Studio 2010 RC. At press time, it remained the only tools preview. The first CTP includes Visual Studio 2010 Express for Windows Phone, the Visual Studio 2010 for Windows Phone add-in, a Windows Phone Emulator, Silverlight for Windows Phone and XNA 4.0 Game Studio. The Microsoft design studio tooling Expression Blend for Windows Phone and the Expression Blend SDK were also made available in a separate download in March.
In response to a forum question about the timing of the WP7 beta SDK, Microsoft Program Manager Peter Torr responded: "There will be some additional features coming online before RTM, such as the pause/resume task model, access to more choosers [and so on], but none of the 'big' ones like native code access or background execution that people have asked for," he wrote in early April. "We love the feedback and it helps us plan for the future, but there's a limit to what we can do in each release."
Developers with Visual Studio have the option to use a Visual Studio 2010 for Windows Phone add-in or the Visual Studio 2010 Express for Windows Phone tooling.
"The main difference is that Visual Studio 2010 Express for Windows Phone only lets you create Windows Phone applications," says Microsoft's Becker. "You have everything you need to crank out those phone apps. You don't have some of the more powerful features of Visual Studio and you certainly can't build desktop apps and other types of applications."
The Visual Studio and Expression Blend tools for Windows Phone offer shared project templates and WYSIWYG controls that pick up the same look-and-feel as WP7 Series skins -- not Silverlight default controls. Among the Visual Studio tools is a Windows Phone Emulator, a virtual machine running the Windows Phone OS 7.0 for debugging, deploying and executing test builds. Applications can also be tested by plugging into a registered WP7 Series test device with a USB connector (once the devices become available).
Developers can use the same Visual Studio project to develop games for multiple devices: Windows PC, Windows Phone and Xbox 360, according to Microsoft. Visual Studio supports the 2-D and 3-D APIs in the XNA Framework. The WP7 platform supports the development of loop-based games and can integrate Xbox Live functionality such as achievements, scores and connecting with other gamers.
Third-party Windows Phone applications are sandboxed with their own virtual file system with no calls to other apps or the Windows Phone OS. Developers can use isolated data storage in the file system or use XML or Web services to connect to other data sources in the cloud, but the platform doesn't support a database such as SQL Server Compact Edition for third-party apps. It's used by Microsoft, according to Kindel, but not surfaced in the first release for development use. The size limit for Windows Phone apps is 2GB, according to Microsoft.
Third-party apps run in the foreground; full multitasking is not supported, although integrated Windows Phone services like the music player, calling and SMS can occur in the background. Developers can also use the Microsoft Notification Service (push notification) to update apps, whether or not they're running on the device.
Calling on Silverlight
Silverlight for Windows Phone creates an opportunity for mobile development at companies like RunAtServer Consulting Inc. in Montreal, which is a Microsoft Silverlight Partner.
"Developing for Windows Mobile previously was a little bit harder because there were tools, but the Compact Framework was too different from the .NET Framework. You needed to know exactly the API related to the Compact Framework," says Louis-Philippe Pinsonneault, a senior .NET developer and trainer at RunAtServer Consulting. "With Silverlight, there's no difference between the API on the desktop and on the phone. It's a lot simpler; you don't have to learn two different sets of APIs. The only difference is that when we're developing in Silverlight, we're targeting Silverlight 4, and for the phone, it's Silverlight 3."
Pinsonneault is currently working on an e-commerce solution for a customer, and he expects to port the Silverlight app to Windows Phone as part of his own project. "There's the opportunity to have a smaller version for the phone, like most people did with the iPhone," he says. "Now with Windows Phone it's very simple to do, so why not do the application based on a real Silverlight application that we just port to the phone?"
Silverlight developers use the same languages (C# and XAML), programming skills and tools to create event-driven applications for the Windows Phone OS 7.0. Not supported in this release, Visual Basic is part of the roadmap, according to Microsoft.
"Anybody who's a Silverlight developer, overnight became a Windows Phone developer. It's really that simple," says Microsoft's Becker. "You can write an app just like you wrote a Silverlight browser app, for instance, or an out-of-browser app -- the main thing is looking for synergies with the phone hardware and OS."
Silverlight for Windows Phone is based on a subset of Silverlight 3, with added support for phone-specific features such as gesture-aware controls, manipulation events, sensors (such as the accelerometer for motion), Microsoft Notification Service, Location Service and Software Input Panel (SIP) on the TextBox control, according to Microsoft.
"Webcam and microphone are things that we've added in Silverlight 4, and we also have them on the phone," explains Becker, which could account for some of the early confusion about Silverlight 3 versus Silverlight 4.
In addition, some features that are supported may behave differently on Windows Phone. For example, it has a unique implementation of IIS Streaming. Like Silverlight for Windows, it also supports hardware-accelerated H.264 video with digital rights management. It does not support HTML5.
Apps are hosted on the device, not inside of the Internet Explorer mobile browser -- therefore Silverlight functionality such as Java-Script programmability, HTML DOM and the plug-in object reference aren't supported.
"We have certain things that are desktop- and browser-related, like integration with the back button, and things like that just don't make sense when you talk about a Windows Phone app," explains Becker. "When possible we pulled things out if it they didn't make sense."
Similarly, Adobe Flash is not supported on WP7, according to Microsoft, although the companies may be working on it. In March, Adobe Principal Product Manager for Developer Relations for the Flash Platform Mike Chambers blogged: "One thing I wanted to clarify ... is that Adobe and Microsoft are working together to bring Flash Player 10.1 to Internet Explorer Mobile on Windows Phone 7 Series."
Other commonly used Silverlight functionalities not available for Windows Phone are P/Invokes, sockets and the Dynamic language runtime. Also, Silverlight SDK features such as Windows Presentation Foundation (WPF) controls, WCF Data Services (formerly known as ADO.NET Data Services), RSS and ATOM feeds, and JSON serialization are not supported, according to Microsoft.
Pinsonneault isn't worried about the lack of plug-in support and other functionality at this early stage in the platform's development.
"For each release of Silverlight, at first they locked many features and then they opened up those features based on the requirements of the user. They probably just locked some features for the current test; either they're not fully necessary or they're probably not fully compatible with the phone," Pinsonneault says. "For example, the phone doesn't support running a Silverlight app inside of the browser; probably there's an infinite loop that could happen. But I'm pretty sure they'll open new functionality as they know more about what people want to do with the phone."
The .NET Compact Framework in Silverlight supports the Common Language Runtime, WCF and Language Integrated Query (LINQ) -- but not from customized data sources. "We find that 90 percent of what people are using on a day-to-day basis is in the Compact Framework," says Becker. "Especially for the types of apps that people are going to build on a phone, it's what you need."
While much of the development is similar, the navigation model on Windows Phone differs from that of Silverlight for Windows applications because of the screen size.
"It's [important] to understand the navigation model because they implemented a navigation bar -- it's a control that's available -- but currently you don't have the designer to create the navigation bar and may have to do it in codebehind," says Pinsonneault, who has given user group presentations on the new technology. "On the [data] side, there's no change. Currently the Windows Phone uses Web services to get data, and we're doing exactly the same thing. With the other tools that they're providing, like the notification services and location services, it will help us achieve some goals that were a bit more difficult to do previously with Silverlight."
Developers also need to pay attention to the way the device works, especially in regard to how to manage tasks, Pinsonneault advises: "If you run an application, what's going on if you launch another application?"
Internally, Microsoft has compiled a single DLL that works on Silverlight for Windows and Silverlight for Windows Phone, Becker says. "If developers are worried about a lot of the kind of gotchas that you normally have when you're cross targeting or moving to a new platform, I think we smoothed out a lot of the rough edges that you normally get with that kind of experience," he says.
The key to developing great apps is to optimize the user experience on a new form factor. "You have to think through what you want your app to do on the phone and whether you want it to behave the same way," advises Becker, "because on a phone, someone is not using a mouse: They're using a touchscreen. So you need to do any design work or UI optimization so that your users have a great experience."
Strategy Still Unfolding
The Silverlight installed base has jumped from 45 percent of all Internet-connected devices worldwide in November 2009 to 60 percent in March, according to Microsoft. That same month, Microsoft India released the first cross-platform version of Silverlight for a non-Microsoft mobile OS. The Silverlight for Symbian beta based on Silverlight 2 enables developers to build apps that run on Nokia S60 5th Edition devices.
"If Microsoft can create a base for Silverlight for any type of device, this will be great because we'll develop one application and we'll be able to deploy it on many platforms," says Pinsonneault. "You develop the app and modify the UI. Behind it is exactly the same model, which is what is great with Silverlight."
Several commercial mobile app developers are also porting their apps to the WP7 platform. Microsoft announced a slew of partners at MIX10 including The Associated Press, AWS Convergence Technologies Inc. (WeatherBug), Citrix Systems Inc., Clarity Consulting Inc., Fandango Inc., Foursquare Labs Inc., Frog Design Inc., Glu Mobile Inc., Graphic.ly, Hudson Entertainment Inc., IdentityMine Inc., IMDb.com Inc., Larva Labs, Match.com LLC, Matchbox Mobile Ltd., Microsoft Game Studios, Namco Networks America Inc., Pandora Media Inc., Photobucket Inc., PopCap Games Inc., Seesmic and Shazam Entertainment Ltd., among others.
Many developers still want to learn more about what's coming, and more about the devices. Battery life, key hardware specifications and the native apps on WP7 had not been fully disclosed at press time. Similarly, Windows Live Services and LiveMesh, still in beta, were not discussed by Microsoft in relation to WP7.
As Microsoft gets closer to launch, the company will work with the community to document what the best practices are, says Becker -- and there are no guarantees. "Right now, we have the CTPs out and it's a great time for people to come and kick the tires and start asking questions," he says.