Advertisment

Introducing Windows Mobile 5.0

author-image
PCQ Bureau
New Update

Earlier this year, the successor to Windows Mobile 2003 development platform was released, which was codenamed Magneto. Magneto overcame a lot of limitations of its predecessor such as SMS capability, Managed POOM (Pocket Outlook Object Model), system state notification and many more. Magneto was released as WM5.0 (Windows Mobile 5.0), building over the Windows CE 5.0 OS.

Advertisment

You can program for WM 5.0 using Visual Studio 2005 Beta 2 and can download the SmartPhone and PocketPC SDK for Windows Mobile 5.0 from

http://msdn.microsoft.com/mobility/.

Once you install it, you will see the relevant project types showing up in the 'Smart Device' project folder as shown in the screenshot.

Direct Hit!
Applies to:

.NET Compact and Windows Mobile developers
USP: Insight into Windows Mobile 5.0 platform development
Primary Link:

http://msdn.microsoft.com/mobility/ 
Google keywords:

Win mobile dev + .NET

By default, the applications built using the templates will target .NET Compact Framework 2.0. However, you will notice that there are a few templates that have '1.0' specified in their titles. 

Advertisment

This indicates that selecting such a template will let you develop a Windows Mobile 5.0 application aimed at .NET Compact Framework 1.0. Thus, it supports both versions of the .NET Compact Framework-a feature of Microsoft Visual Studio 2005.

In this article, we will discuss such and other enhancements, specifically in Windows Mobile 5.0. 

New namespaces



Windows Mobile 5.0 encompasses its enhancements in the following five namespaces.

Advertisment

Microsoft.WindowsMobile.PocketOutlook



This namespace is the managed interface to the Pocket Outlook Object Model, better known as POOM. It allows you to work with the contacts, tasks, appointments that are synchronized with your desktop.

The SDK provides project templates aimed at the 1.0 and 2.0 releases of the .NET Compact Framework 

You can create, edit and delete them-get notifications as to when a delete or modify operation has taken place upon a POOM object (using native APIs) and even create custom properties and assign them to a POOM object.

Advertisment

Apart from this, it contains functionality for you to send SMS via managed code-and also intercept them!

Microsoft.WindowsMobile.Telephony



This namespace contains a single class-Phone-that allows you to make phone calls. The class has a single

method-Talk-that will do the needful as shown below.

Phone objPhone = new Phone();



objPhone.Talk(txtNumber.Text);

Advertisment

Microsoft.WindowsMobile.Status



Have you ever thought about writing mobile applications that could respond when the system state changes? For instance, how about an application that would be automatically launched if you got a missed call and automatically send the caller an SMS indicating that you are not available and also send you an e-mail giving details about the call.

Well, now this is possible. The 'System State and Notification Broker' has both managed and unmanaged APIs that will notify your application for the registered state change. There are over 100 potential states that you can be notified about-ranging from battery status to new e-mail to SMS messages received to change in the network operator.

Microsoft.WindowsMobile.Forms



Working with the camera of your mobile device, or selecting contacts from the POOM contact list was a thing you could not do earlier. 

Advertisment

This namespace contains functionality for you to pop up a dialog to the user to select a Contact, or a Picture, or even click on pictures or shoot video using a simple managed API! As expected, even the unmanaged API now supports it.

Working with SMS



Capability to send SMS is one of the key features of Windows Mobile 5.0, available in both PocketPC and SmartPhone SDK (yes, there are certain features that are not common across the platforms!). Getting to send SMS from your application is as simple as doing the following.

  • Create a Windows Mobile 5.0 PocketPC or SmartPhone project and add reference

    to 'Microsoft.WindowsMobile.PocketOutlook' assembly.
  • Import the 'Microsoft.WindowsMobile.PocketOutlook' namespace. Work with the 'SmsMessage' class as shown below.
Advertisment

SmsMessage sms = new SmsMessage();



sms.To.Add(new Recipient("+14250010001"));


sms.Body = "Testing the SMS API of WM 5.0";


sms.Send();

The above snippet sends an SMS to the number enclosed as a 'Recipient' object. Infact, the number used above can be used by the SMS API or the Phone API (discussed earlier) to try the APIs within the emulators of Windows Mobile 5.0. 

Thus, when a call is made to this number, the emulator intercepts it and dials a fake call. Likewise, when an SMS is sent to this number, the emulator intercepts it and sends the SMS to itself. 

Thus, the developer experience is quite realistic in terms of how the application will behave.

What's next?



This is just a basic introduction to some of the new features of Windows Mobile 5.0. 

Next month, we shall take this ahead and see how we can write applications that can intercept SMS and also understand the System State Notification Broker. 

Meanwhile, you can use the code, we have put in the PCQEssential CD, that comes with the article, to try out Windows Mobile 5.0. 

Kumar Gaurav Khanna

Advertisment