icrosoft has recently announced the release of Windows Mobile 6 to device manufacturers. While it will be sometime before you can get your hands on a Windows Mobile 6 device, Microsoft has since released the Windows Mobile 6 SDK so that developers can have an early look at it and prepare for the impending launch of these newer devices. A good portion of the features of the newer platform is for native developers (using Embedded Visual C++), and it will take some time for these new features to be supported on the .NET Compact Framework, making them available to managed developers. Nevertheless, the release of Windows Mobile 6 contains some cool new tools and utilities for managed developers.
With the launch of Windows Mobile 6, Microsoft has yet again introduced a new naming convention for Windows Mobile devices. Table 1 shows the new names for each device category.
Previously known as
Now known as
Windows Mobile 5.0 Pocket PC
Windows Mobile 6 Classic
Windows Mobile 5.0 Pocket PC Phone Edition
Windows Mobile 6 Professional
Windows Mobile 5.0 Smartphone
Windows Mobile 6 Standard
Table 1. New Naming for Windows Mobile devices
The previous version of Windows Mobile has a point release number, which is Windows Mobile 5.0. But in this latest version, Microsoft has decided to do away with the point and simply calls it Windows Mobile 6 (and not Windows Mobile 6.0).
Downloading the SDKs
To develop for the Windows Mobile 6 platforms, you need to download two SDKs, depending on the platform you are targeting:
- Windows Mobile 6 Classic/Professional: Windows Mobile 6 Professional SDK (Standard and Professional)
- Windows Mobile 6 Standard: Windows Mobile 6 Standard SDK
Both SDKs can be downloaded here.
Note that installing the new Windows Mobile 6 SDKs requires the following:
- Visual Studio 2005 SP1 or later
- ActiveSync 4.5
- .NET Compact Framework 2.0 SP1
If you don’t have the prereq before installations, a dialog will appear during the installation process. Simply click on the Prerequisites button to download the appropriate components you are missing.
New Project Templates
When the SDKs are installed, you’ll find two new project types listed under the Smart Device item in Visual Studio 2005: Windows Mobile 6 Professional and Windows Mobile 6 Standard.
|Figure 1. The Tools: These are installed with the Windows Mobile 6 SDKs.|
Note that unlike Windows Mobile 5.0 projects, you do not have a choice to choose the older version of the .NET Compact Framework (which is version 1.0). This is because Windows Mobile 6 devices will now come preinstalled with:
- .NET Compact Framework 2.0 SP1 in ROM
- SQL Server 2005 Compact Edition in ROM
This will greatly simplify the deployment process, because it eliminates the need to explicitly bundle the .NET Compact Framework 2.0 distributable with your applications.
Once the SDKs are installed, you will find the Windows Mobile 6 SDK menu item installed in your Start menu (Figure 1).
The Windows Mobile 6 SDKs comes with the following emulator images:
- Windows Mobile 6 Standard SDK
- Windows Mobile 6 Standard (176×220 pixels – 96 dpi)
- Windows Mobile 6 Standard Landscape QVGA (240×320 pixels – 131 dpi)
- Windows Mobile 6 Standard QVGA (320×240 pixels – 131 dpi)
- Windows Mobile 6 Professional SDK
- Windows Mobile 6 Classic (240×320 pixels – 96 dpi)
- Windows Mobile 6 Professional (240×320 pixels – 96 dpi)
- Windows Mobile 6 Professional Square (240×240 pixels – 96 dpi)
- Windows Mobile 6 Professional Square QVGA (320×320 pixels – 128 dpi)
- Windows Mobile 6 Professional Square VGA (480×480 pixels – 192 dpi)
- Windows Mobile 6 Professional VGA (480×640 pixels – 192 dpi)
|Figure 2. The Emulator Images: And their screen sizes.|
Figure 2 shows some of the emulator images and their screen sizes.
Device Emulator v2
The Windows Mobile 6 SDK’s emulators are now much more realistic and offer significantly improved performance. You can now also emulate different battery power levels, as well as speakerphone, headset, and car kit (see Figure 3).
|Figure 3. Emulating Different Peripherals: Battery power levels, speakerphone, headset, and car kit.|
For example, suppose your application wants to monitor the battery power status and issue a warning when the battery power is low. You can do the following:
Imports Microsoft.WindowsMobileImports Microsoft.WindowsMobile.StatusPublic Class Form1 Private WithEvents batteryState As Status.SystemState Private Sub Form1_Load( _ ByVal sender As System.Object, _ ByVal e As System.EventArgs) _ Handles MyBase.Load batteryState = New Status.SystemState( _ SystemProperty.PowerBatteryState) End Sub Private Sub batteryState_Changed( _ ByVal sender As Object, _ ByVal args As Microsoft.WindowsMobile.Status.ChangeEventArgs) _ Handles batteryState.Changed If SystemState.PowerBatteryStrength = BatteryLevel.Low Or _ SystemState.PowerBatteryStrength = BatteryLevel.VeryLow Then MsgBox("Please remember to save your work.") End If End SubEnd Class
In this case, you can adjust the battery power level of a device and see how your code reacts to it. The battery level in Figure 3 is adjusted to 5 percent. Figure 4 shows the Main Battery Very Low notification message and the message displayed by your code (on the right).
|Figure 4. Emulating Low-battery Status: The message displayed by your code is on the right.|
Cellular Emulator v1
One very useful tool in the Windows Mobile 6 SDKs is the Cellular Emulator. The Cellular Emulator emulates real phone functionalities such as voice calls and SMS messaging. To use the Cellular Emulator with your Windows Mobile emulator, launch it from Start | Windows Mobile 6 SDK | Tools | Cellular Emulator and observe the serial port number it uses (see Figure 10). In this case, the port is COM3.
Next, open up the Emulator Properties window by going to File | Configure… and enter the port number (COM3) under Serial Port 0.
Using the Windows Mobile emulator, you can emulate making a phone call by calling one of the pre-fixed numbers (Figure 5):
- 7272024 – Busy
- 7272020 – Reject
- 7272021 – Hang Up after Connect
- 7272022 – No answer
You can also use the Cellular Emulator to make calls to the Windows Mobile emulator, as shown in Figure 6.
For network emulation, the Cellular Emulator allows you to emulate 2G and 3G networks (see Figure 7).
For SMS messaging, you can send a message from the Windows Mobile emulator and if the message is sent correctly, the Cellular Emulator will receive it (see Figure 8).
Conversely, you can also send a SMS message from the Cellular Emulator to the Windows Mobile emulator (see Figure 9).
The ability to send SMS messages using the Cellular Emulator is very useful?especially if you are writing SMS applications and need to filter incoming messages. For example, the following code snippet will intercept all incoming messages, pass them to your application for processing (in this case display the content of the message on the screen), and delete them:
Imports Microsoft.WindowsMobile.PocketOutlook.MessageInterception'---add reference to Microsoft.WindowsMobile.PocketOutlook---Public Class Form1 Dim msgInterceptor As MessageInterceptor Private Sub Form1_Load( _ ByVal sender As System.Object, _ ByVal e As System.EventArgs) _ Handles MyBase.Load msgInterceptor = New MessageInterceptor( _ InterceptionAction.NotifyAndDelete, True) '---set the event handler for the message interceptor AddHandler msgInterceptor.MessageReceived, _ AddressOf smsInterceptor_MessageReceived End Sub '---event handler for the MessageReceived event Private Sub smsInterceptor_MessageReceived( _ ByVal sender As Object, _ ByVal e As MessageInterceptorEventArgs) Dim msg As Microsoft.WindowsMobile.PocketOutlook.SmsMessage msg = e.Message MsgBox(msg.Body) End SubEnd Class
You can also configure the Cellular Emulator to continuously send SMS messages to the Windows Mobile emulator at regular time intervals (Figure 10).
GPS Test Utility?FakeGPS
One cool new utility in the Windows Mobile 6 SDK is the FakeGPS utility. This utility allows you to test GPS functionalities without the need to purchase a real GPS receiver. It works by reading sample GPS sentences and passing them to the GPS Intermediate Driver (GPSID). To test GPS functionalities with FakeGPS, perform the following steps:
- In Visual Studio 2005, select Tools | Device Emulator Manager…
- Right-click on the Windows Mobile 6 Professional Emulator and select Connect. This will launch the Windows Mobile emulator. Then right-click on it again and select Cradle. This will connect the Windows Mobile emulator with ActiveSync.
- In ActiveSync, click on the Explore button and a window will appear, displaying the folders inside the emulator. Double-click on the item named My Windows Mobile-Based Device.
- In Windows, open the folder containing the FakeGPS application (C:Program FilesWindows Mobile 6 SDKToolsGPS) and copy the FakeGPS.cab into the folder opened by ActiveSync. When prompted, click Yes.
- In the Windows Mobile emulator, launch File Explorer and navigate to My Device. Tap on the FakeGPS item to install it on the device. The FakeGPS utility will not be installed in the My Device | Program Files | FakeGPS folder.
- Launch the FakeGPS utility and enable it (see Figure 11).
The Windows Mobile 6 SDKs contains a sample GPS application (C:Program FilesWindows Mobile 6 SDKSamplesPocketPCCSGPS) that talks to the GPSID through a managed wrapper. Figure 12 shows how the application looks like when run on the emulator.
Only the Beginning
This article has shown you some of the new tools and utilities that shipped with the Windows Mobile 6 SDKs. Future articles will dive more deeply into the new APIs offered by Windows Mobile 6, both native APIs and managed classes.