Read an Excerpt
Beginning Windows Phone 7 Application DevelopmentBuilding Windows Phone Applications Using Silverlight and XNA
By Nick Lecrenski Karli Watson Robert Fonseca-Ensor
John Wiley & SonsCopyright © 2011 John Wiley & Sons, Ltd
All right reserved.
Chapter OneIntroducing Windows Phone 7
WHAT YOU WILL LEARN IN THIS CHAPTER:
* Learning the history of the Windows Mobile platform
* Understanding the new Windows Phone 7 platform
* Understanding the differences between Silverlight and XNA
* Using Windows Phone 7 development tools
* Creating your first Windows Phone 7 app
As you may have noticed lately, mobile application development is at the forefront of the industry. Not since the glory days of the mid- to late 1990s has it been quite this exciting to be a software developer. Why all this new excitement about a hardware platform that has existed for quite some time? You don't have to look much further than the introduction of cheaper smartphones to the masses. Even grandma and grandpa probably have a smartphone by now, and they may want to know when you are going to start writing your own mobile app. Of course, to do so, you need to pick a smartphone platform. Given that you have picked this book, it's safe to assume that you're going to write applications for the latest entry into the smartphone world: Windows Phone 7.
Even though we seem to be entering an era where Droid and iPhone are becoming the dominant platforms for mobile development, it is important to note that Microsoft actually did have a viable mobile development platform before most of the other companies even had any plans to enter this market. So although Microsoft is seemingly late to the party, it really isn't: It has quite a bit of history and experience in mobile development. In fact, in many ways, Windows Phone 7 provides developers with an even richer set of tools and programming opportunities than either the Droid or iPhone platforms.
THE WINDOWS MOBILE PLATFORM
Prior to the current generation of smartphone hardware, most users were relegated to using simple cellphones that could deal with calls, text messages, and possibly a handful of basic games or applications. More often than not, these applications weren't much more powerful than a glorified calculator. There was no app store, no programming interface was available to you, and unless you were an official partner with one of the major cell networks, you simply couldn't write custom applications for your phone, let alone share them with others. The original Pocket PC hardware teamed with the first version of Windows Mobile to change this.
The Windows Mobile platform came on the scene in 2000, on the Pocket PC hardware. It provided developers with some of the first legitimate opportunities to create applications for mobile devices. Although geared primarily toward power users and corporate accounts, this new mobile operating system offered versions of Word, Excel, Outlook, Internet Explorer, Windows Media Player, and more. Obviously, this was not going to be just your standard cellphone with limited capabilities. Along with the operating system, Microsoft released a set of developer tools that allowed those with a C++ background to develop native applications for the Pocket PC.
So if custom applications could be developed and the Pocket PC was available, why did it take the iPhone to make mobile computing catch on? For starters, although the Pocket PC and its successors continued to use various releases of Windows Mobile, the platform stayed geared toward power and corporate users. Data plans for such devices were costly, and the devices were often out of the price range of standard cellphone users. Besides, who wants to browse the Web at extremely slow speeds on a tiny little screen? In the early 2000s, home computers and broadband modems were better suited for browsing. Browsing the web on mobile devices was often slow and painful. It also didn't help that in order to use Windows Mobile devices, you had to use a stylus pen. Those devices weren't nearly as simple and powerful as today's multitouch mobile devices.
Another issue, in addition to cost, user experience, and data speed, was testing applications across a myriad of devices. Developers who were interested in creating Windows Mobile solutions also had to wrestle with the fact that with each new release of the Windows Mobile operating system, many new devices would also be released. Some of these new devices would have screen resolutions and features that were not supported in existing applications. Developers therefore had to worry about porting and testing their applications across a wide variety of devices. Applications written for one Windows Mobile device were not always guaranteed to work on another similar device. This further hurt any chance of building up a large user base for various applications and in turn hurt the overall mobile development market.
Here Comes the iPhone
In 2007, after a myriad of Windows Mobile releases, along with various versions of the popular BlackBerry devices, Apple jumped into the fray and released a phone completely designed from the ground up with the everyday consumer in mind. The first iPhone hit the market, forever changing mobile computing. There was no denying that this new phone was slick and easy for just about anybody to use. The iPhone brought better web browsing, better camera functionality, and a fluid touchscreen interface, including multitouch and even gestures such as "pinch" and "flick." It didn't take long for people who tried the phone to fall in love with its features.
In addition to all offering new hardware features, the iPhone was the first smartphone to allow anybody to develop custom applications for the phone and even distribute them with the intent of potentially making a profit. The concept of having only one standardized device along with a public marketplace to easily distribute and collect royalty payments sounded like the Holy Grail that developers had been waiting for with regard to mobile application development.
Of course if users hadn't bought iPhone devices in droves, there wouldn't have been much benefit to spending valuable resource time on iPhone development. However, because Apple partnered with AT&T, it was able to make the iPhone somewhat affordable and available to an extremely large audience. This is just what the doctor ordered for the then-stagnant mobile development landscape.
After just a few years and a couple of revisions of the proprietary operating system used by the iPhone, its popularity soared and essentially set the standard for what users were looking for from a smartphone. People who had never before considered using cellphones for anything other than making calls and sending text messages were suddenly checking sports scores, watching video clips, and even posting status updates to their Facebook accounts. As with any other new technology, competition was sure to arrive.
There was simply no way that the success of the iPhone was going to go unnoticed by the other major players in the computing world. Sales of existing Windows Mobile devices began to plummet, as users began to demand iPhone functionality in all their mobile devices, regardless of the manufacturer.
Microsoft and a small company called Google began to take notice of the iPhone and the rapidly growing consumer market for smartphone devices. Google quickly set to work on its own mobile solution, but instead of focusing on hardware, Google actually went to work on its own mobile operating system that would include many of the innovations found in the iPhone's proprietary system. However, Google would offer the operating system for free, and it would also release its own software development platform that would not be as closed and proprietary as that of the iPhone. Google was hoping to attract even more developers to create rich mobile applications for devices running its Android operating system. In addition to the operating system and development tools, Google opened an app store similar to iTunes, where users of Android-based devices could be able to easily find rich mobile applications to load onto their devices. The Google-based marketplace soon offered thousands of applications, many of which were free or very low cost because there were no expensive licensing fees involved with Android application development.
Not long after the release of the Android operating system, cellphone manufacturers began releasing devices that made use of Google's technology. At that point, the mobile development marketplace was beginning to seem lucrative to cellphone carriers, and Google capitalized on the fact that iPhone development and devices were available only through AT&T's networks. All other carriers would be free to latch on to Android and offer their customers features similar to those of the iPhone with much lower costs. The largest cellphone provider, Verizon, released the Droid phone based on the Android operating system. Google's new entry into the mobile marketplace was pretty much guaranteed to explode just like the iPhone had. In fact, at the time of this writing, Androidbased devices have actually started to do just that, even outselling new iPhone devices in some U.S. markets.
A Microsoft Reboot
With the success of the iPhone and the explosion of Android-based devices onto the scene, Windows Mobile device sales again took a hit. It became increasingly clear to Microsoft that its current Windows Mobile solution was not going to cut it. Rather than continue on the current path and release another version of the existing Windows Mobile operating system, Microsoft decided to go back to the drawing board and start over, with a clear plan of attack, to revive its struggling mobile division.
To ensure that the next generation of Windows Mobile satisfied the needs of the exploding consumer market for mobile devices, Microsoft revamped every aspect of its mobile operating system. To create a successful product, Microsoft needed to touch on all the areas of concern for consumers and developers in previous releases of Windows Mobile. At the Mobile World Congress in 2010, Microsoft officially took the covers off the first version of its mobile reboot: Windows Phone 7 Series.
It didn't take long to see that this was not the traditional Microsoft mobile platform. Everything about this operating system was different. From the new multitouch capabilities to the slick Metro user interface, designers at the conference instantly took to the new release. In the old days, Microsoft had offered a multitude of devices with varying screen resolutions and hardware features. Finally, Windows Phone 7 Series promised a standardized set of hardware. And, importantly, it offered an SDK and development platform that utilized .NET and Silverlight, two technologies that already had a massive developer base. To the excitement of many, developers already utilizing Silverlight in their solutions became Windows Phone 7 Series developers overnight.
Despite heavy competition from Google and Apple, there was more than enough promise even in this early stage that the new Microsoft entry into the mobile computing world would surely become a hit and continue to provide needed competition in the mobile development world.
At MIX 2010, Microsoft released the first edition of development tools so that developers everywhere could start working on Windows Phone 7 Series solutions. Unlike Android and iPhone development, Windows Phone 7 Series development made use of tools that were already very familiar to developers in Visual Studio. Harnessing Visual Studio, .NET, and Silverlight allowed Microsoft to drastically reduce the learning curve normally associated with mobile development. MIX 2010 provided attendees with exciting demos of Silverlight applications as well as powerful games that even had Xbox 360 integration by making use of the already available and familiar XNA development platform. Now even making mobile games would be something that any developer would be able to jump into.
Microsoft wasted no time in announcing the creation of its own app store and developer program that would allow Windows Phone 7 Series developers to create and distribute applications as well as potentially generate profits for their work. In September 2010, Microsoft offered the final release of its development tools, including an updated and even more powerful emulator for testing. Developers were encouraged to finalize applications and get ready for the impending release of Windows Phone hardware. At the same time, the official name of the new operating system was shortened to the easier-to-remember Windows Phone 7.
THE WINDOWS PHONE 7 PLATFORM
The Windows Phone 7 platform has been officially released, and the first wave of devices utilizing the operating system is hitting the market. It's time to start learning how to use the platform to create your own mobile applications and solutions and perhaps even make some money through the new Windows Phone 7 application marketplace.
In the next section, you'll get a brief overview of the Windows Phone 7 platform and a look at the developer tools that are available. Before you finish, you'll have built your first working Windows Phone 7 application. To get started, let's take a quick look at the major components of this new platform.
Windows Phone 7 Hardware Specifications
To avoid many of the problems that plagued application development in previous versions of the Windows mobile operating system, Microsoft decided to follow the lead of Google and Apple and come up with a hard list of requirements for hardware vendors. Rather than allow for an unlimited set of hardware configurations, Microsoft has been specific about the capabilities each Windows Phone 7 device must have. A user should be able to pick up any given Windows Phone 7 device and recognize how to use it without a major learning curve. No two devices should be so different from each other that they're difficult to use or program against. Ultimately, as a Windows Phone 7 developer, you're expected to develop applications against Microsoft's constrained list of potential hardware features. If you do, you won't have to worry about porting your application several times for it to run correctly across a myriad of Windows Phone 7 devices released by various cellphone manufacturers.
Table 1-1 lists the minimum hardware requirements for all Windows Phone 7 devices.
As you can see from Table 1-1, Microsoft has not created a basic smartphone. Windows Phone 7 devices are on par with both Android-based devices and iPhones. They're powerful and enable rich application development.
Windows Phone 7 Architecture
In addition to the powerful list of standardized hardware features, the Windows Phone 7 platform provides developers with an architecture conducive to rapid and rich application development. The Windows Phone 7 architecture is divided among four main components:
* Runtime components
* Cloud services
* Portal services
A good place to start getting familiar with the Windows Phone 7 architecture is to take a look at the various runtime components. Figure 1-1 shows a complete list of the items that make up the runtime piece.
Silverlight does require the end user to install a small lightweight plug-in similar to the popular Flash plug-in. The installation, however, is fast, not typically a painful experience for end users.
Offering the capability to create rich web-based applications without the distribution headaches that can sometimes accompany thick client development, Silverlight has exploded in popularity. Many large companies — such as Netflix, Continental Airlines, and Kelley Blue Book — use it.
As you will soon see, Silverlight development for the Windows Phone 7 platform is similar to Silverlight development for the web. Although Windows Phone 7 uses a custom version of Silverlight, most of the functionality available on the web is also available in the mobile version of the runtime. Silverlight also provides a powerful suite of controls that you can use in your applications to handle the display of data, user input, and more. In addition, most of these controls have already been customized to make use of the new Metro user interface style that is inherent to Windows Phone 7.
Excerpted from Beginning Windows Phone 7 Application Development by Nick Lecrenski Karli Watson Robert Fonseca-Ensor Copyright © 2011 by John Wiley & Sons, Ltd. Excerpted by permission of John Wiley & Sons. All rights reserved. No part of this excerpt may be reproduced or reprinted without permission in writing from the publisher.
Excerpts are provided by Dial-A-Book Inc. solely for the personal use of visitors to this web site.