Professional Microsoft Smartphone Programming

By Baijian Yang Pei Zheng Lionel M. Ni

John Wiley & Sons

Copyright © 2007 John Wiley & Sons, Ltd
All right reserved.

ISBN: 978-0-471-76293-5

Chapter One

Introduction to Microsoft Smartphone

Mobile computing is everywhere today. The number of cell phones, PDAs, and other handheld mobile devices has exceeded the number of computers in the world. The Yankee Group estimates that there are approximately 1.8 billion mobile devices in use worldwide, used for a variety of tasks, including the still predominant voice communication, text messaging, web surfing, e-mail, gaming, and so on. As wireless technologies such as 3G cellular systems, wireless LANs, Bluetooth, WiMAX, and Ultra-Wideband continue to mature, empowering those mobile devices and the network infrastructure, we soon will be able to enjoy the power of mobile computing anywhere, anytime, and on any devices.

What will ultimately cause this vision to materialize are new mobile applications and services built on the pervasive computing infrastructure, along with a set of software platforms and programming tools. Motivated by this vision, we decided to write a book on one of the most powerful software platforms for mobile computing: the Microsoft Smartphone. This chapter begins with a brief introduction to smartphones and the challenges of developing smartphone applications. Then we introduce Microsoft Windows Mobile and some related technologies. Readers will likely find this section informative, as it clarifies some terms and concepts pertinent to Microsoft Smartphone.

What Is a Smartphone?

The worldwide mobile wireless industry is quickly moving from traditional, voice-based cellular phone services to combined voice and data services, as a result of increasing demand for mobile data access and the deployment of high-speed wireless data services utilizing a variety of wireless technologies. For example, 2.5G/3G wireless services are being rolled out and used by a rapidly growing number of subscribers, and the number of WiFi hotspots and residential wireless LANs continues to grow substantially. The trend is clear: Cell phones, PDAs, and portable consumer electronic devices will likely merge into a single, handheld device as a universal personal communicator and computing platform (generally called a smartphone). Indeed, the market has seen a dramatic increase in smartphone sales when compared to the fairly slow growth of PDA sales worldwide.

Generally, a smartphone is a powerful, multi-function cell phone that incorporates a number of PDA functionality, such as a personal scheduler, calendar, and address book, as well as the ability to access Internet services and applications using either a keypad or a stylus. In addition to making a call from a smartphone, users can surf the web, check e-mail, create documents, play online games, update schedules, or access an enterprise network via a virtual private network (VPN). Wireless Internet access is enabled by means of cellular wireless networks - such as GSM/GPRS, CDMA, CDMA2000, or WCDMA, among others.

Bill Gates, Chairman and then Chief Software Architect of Microsoft, introduced his vision for the smartphone at the 2004 Mobile Developer Conference:

The pocket devices, phone and PDA, really the trend is to have the best of both together. The phone is no longer just a voice-only device; more and more it has that rich, color screen. A PDA is no longer a disconnected device; more and more it's got the ability to make calls and connect up to wireless data networks. In many cases that will be both the wide area data networks, 2 1/2 G or 3G networks, but also increasingly you'll have WiFi connectivity built into the device as well. So it will be able to connect up to whichever network is available, whichever one provides the best bandwidth and economics there.

An increasing number of high-end cell phones and smartphones are equipped with powerful mobile processors (such as ARM processors), 64-128MB memory, 256-512MB flash storage, and even 2-4GB hard drives. Examples include the Motorola Q, SPV C600, and O2 XDA II. Some smartphones are PDA-based with handwritten recognition or a tiny keyboard, and phone functions as add-on features, such as Palm Xplore and Palm Treo. In fact, cell phone manufacturers and PDA manufacturers have different views regarding the future of smartphone devices. Unsurprisingly, each camp believes their device will prevail, with add-on functionality of devices from the other side. As wireless technologies and the mobile market continue to evolve, it is still too early to tell which approach will finally win. Nevertheless, one thing is certain: They both need reliable, high-performance, low-power consumption operating systems and software to leverage the wireless services.

Microsoft Smartphone refers to Microsoft's platform for next-generation cell phones - basically a software architecture with Windows CE as the operating system, plus a rich set of applications such as Pocket Internet Explorer and Pocket Outlook and powerful software development tools such as .NET Compact Framework and Visual Studio 2005. (We use Smartphone to refer to Microsoft Smartphone throughout this book and smartphone to refer to general multifunction cell phones.)

This book focuses on software development issues and practices on smartphones running Microsoft Windows Mobile software. There are, of course, other software development solutions. For example, Palm Inc., also provides a software development kit (SDK) for Palm OS smartphones, and you can find an SDK and supporting tools for Symbian OS, another popular cell phone operating system.

Smartphone Applications and Services

With the vision of mobile convergence supporting communication and computing on a single set of hardware components, mobile wireless network operators, cell phone manufactures, and independent software vendors are working together to create new applications and services with the hope of taking a lead position in the next wave of mobile computing. These services and applications essentially leverage the increasingly high computing capability supplied by the cell phone and the flexible, high-speed wireless connectivity to offer an efficient, reliable, and rich experience to the end user. This section summarizes the potential services and applications in this domain.

Mobile Commerce

This category includes mobile banking, location-based business information service and shopping assistance, mobile advertising, and mobile payment, among other services. Japan and Korea already offer widespread mobile payment applications that enable consumers to make purchases at a convenience store by waving the cell phone past a reading device. Numerous startup companies in the United States are developing applications that enable credit card payments to be verified, parking fees to be paid at the meter, and social networking. Industries involved in this category include banks, credit card companies, retail stores, stock trading agencies, and online businesses.

Mobile Enterprise

Services and applications in this category are concerned with mobile worker assistance such as real-time job scheduling, route planning, package delivery updates, mobile collaboration and communication, and mobile business transaction. Moreover, enterprise resource planning (ERP) applications and supply chain management (SCM) systems can be extended to support mobile access and onsite processing. In addition to mobile enterprise, law enforcement, educational, and healthcare organizations may also utilize these services and solutions to improve productivity and reduce costs.

Mobile Data Service and Entertainment

This category includes real-time, location-based navigation assistance coupled with traffic data access, mobile gaming, rich media services, and so on. Mapping and GPS-based navigation services are increasingly being integrated into general-purpose smartphone platforms. Mobile television services have been available in the United States and some Asian countries; online music download services (such as Apple's iTunes service) are available on some high-end smartphones; mass media companies, music and movie companies, online gaming service providers, and of course the consumer, will be involved in this category of services and applications.

Needless to say, the aforementioned summary is by no means exhaustive; however, it is indicative of the broad range of new services and applications with tremendous potential for businesses. Indeed, the enormous opportunity of next-generation mobile computing has created myriad services and applications that will likely continue to mature and succeed in the foreseeable future. What all these services and applications share is a reliance on software running on smartphones to reach the end user. To this end, software designers and developers have to be aware of the challenges and obstacles involved in smartphone-based application development.

Challenges of Smartphone Application Development

The application design paradigm for smartphones not only differs largely from that of desktop applications, it also has some inherent requirements that separate it from application development on common mobile devices. First, the hardware constraints of a smartphone, such as processor speed, persistent storage capacity, battery, and wireless connection, significantly affect the application design principles. Second, the input method of a smartphone, either a telephone keypad with additional navigation keys or a soft keyboard, forces application developers to pay more attention to the GUI of a smartphone application than that of desktop applications. Third, the cost of wireless data service remains a major factor for mass adoption of Smartphone technology, as it is still quite high compared with the cost of landline Internet services. Moreover, the application must be easily ported to various hardware platforms using different processor architectures and peripherals. Following are the salient factors to consider while developing applications for smartphones:

Efficient storage and adaptive networking. Despite the advancements in mobile embedded and wireless technologies, smartphones usually have neither a large memory capacity nor a reliable, high bandwidth wireless connection. It is crucial, therefore, to make better use of precious local storage for high performance. The networking functionality of a smartphone must be able to adapt to the comparatively low bandwidth and high drop rate of wireless links. Finally, remote data access must be able to function in disconnected mode. For a more detailed discussion of data access on a smartphone, see Chapters 5 and 6.

Simple and user-friendly GUI. Because entering characters on a smartphone is not as easy as typing on a PC keyboard (although some teenagers will disagree), a program's GUI has to deal with most of the input by using graphical components. Due to a smartphone's relatively small screen, the layout of these components on a window, as well as the grouping of components into different windows, has to been designed carefully. For example, you generally should eliminate horizontal scrolling for a smartphone application. GUI design is discussed in more detail in Chapter 4.

Lightweight computation and power management. A smartphone is not designed for CPU-intensive applications; instead, most CPU-intensive computation should be done on the server side, which is typically much more powerful than a mobile processor, of an application whenever possible, enabling the client side on a smartphone to run faster. This creates a scenario for peer-to-peer mobile applications, whereby mobile nodes essentially serve each other without relying on a central server. Web services is a good example of offloading computation to the server. Chapter 9, "XML and Web Services," provides more details about accessing web services on a smartphone. Power management is also crucial to increasing battery life. Smartphone operating systems must be able to put the device into power-save state whenever possible (subject to a user's configuration) to save battery power.

High security. In a sense, a smartphone can be viewed as another form of personal identification, with sensitive data stored and transmitted over the air. There have been a number of cell phone-related security hacks utilizing various vulnerabilities of cell applications. As the smartphone evolves to function not only as a telephone but also as a credit card or ID card, the compromise of a cell phone will result in serious problems. Low-overhead authentication and authorization must be enforced for critical smartphone applications. Chapter 12, "Device and Application Security," and Chapter 13, "Data and Communication Security," cover smartphone security issues.

Introducing Microsoft Windows Mobile

To facilitate the design and development of smartphone applications, hardware manufactures and software vendors have teamed up to provide powerful programming tools for smartphone developers. One of the solutions is Microsoft's Windows Mobile, a unified platform specifically designed to enable developers to leverage Windows desktop programming experiences for mobile application design and development targeting both smartphones and PDAs. Because of the innovative .NET Compact Framework and bundled programming tools, Microsoft Windows Mobile for Smartphone has gained a sizable amount of popularity among software developers worldwide.

Windows Mobile is Microsoft's software platform for Pocket PCs (PDAs running Microsoft's software platforms) and Smartphones (smartphones running Microsoft's software platform). Here the notion of "software platform" refers to an integrated computing environment that consists of an operating system, the .NET runtime environment, a set of applications, and related application development tools. The concepts of "Pocket PC" and "Smartphone" are also commonly referred to as software platforms targeting PDAs and smartphones, respectively.

Windows Mobile 5.0

The latest version of Microsoft Windows Mobile is Windows Mobile 5.0. Windows Mobile consists of a tailored Windows CE operating system; the Microsoft .NET Compact Framework (the runtime and the class libraries); a set of tools and APIs for native code development; a device software emulator; and for developers, an IDE (Integrated Development Environment) component for Visual Studio 2005.

Windows Mobile 5.0 is based on the Windows CE .NET 5.0 operating system. As part of the Smartphone offering, Microsoft also provides the Smartphone 2005 SDK for ISVs (independent software vendors). Developers can use the Smartphone SDK in conjunction with Visual Studio 2005, the flagship programming environment tool from Microsoft, for .NET Compact Framework-based managed code application development. The Smartphone SDK also allows C or C++ unmanaged application programming utilizing Win32 APIs using Microsoft embedded Visual C++ (eVC). The next version of Windows Mobile is called Windows Mobile 6.0 and code named Photon.

Windows Mobile 5.0 unifies application development for Smartphones and Pocket PCs by providing the same Win32 APIs and a set of development tools. Unlike the previous version of Windows Mobile, Windows Mobile 2003, which does not allow developers to use SQL Server CE in Smartphone applications, now both Pocket PC and Smartphone platforms can take advantage of the same set of common data services provided by SQL Server 2005 Mobile Edition, the next release of SQL Server CE. In addition, both platforms share the same security model and the same common application installer. The unification of these two platforms reflects Microsoft's mobile platform strategy in response to the imminent convergence of these two types of mobile devices.


Excerpted from Professional Microsoft Smartphone Programming by Baijian Yang Pei Zheng Lionel M. Ni Copyright © 2007 by John Wiley & Sons, Ltd. Excerpted by permission.
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.