If you are a Microsoft developer familiar with the .NET Framework, you generally have two options if you want to write mobile applications. For mobile handsets, you can develop mobile web applications using the ASP.NET Mobile controls. For standalone applications, you can use the .NET Compact Framework. However, using the .NET Compact Framework, you can only target Pocket PC devices. And that essentially means that you are out of luck when it comes to developing for competing devices such as Palm and Symbian Smartphones.
A new product from AppForge (www.appforge.com), known as Crossfire, promises to close the gap. Using Crossfire, you can leverage on your familiarity with VB.NET (or Visual Basic 6) and write cross-platform mobile applications supporting a wide variety of devices. What that means to a developer is that you now do not need to use the proprietary SDK for each device platform -- you simply maintain one code base and it can then be deployed to multiple platforms.
Crossfire supports the following platforms:
Figure 1 shows some of the devices that are supported by Crossfire.
Figure 1. The Nokia 6600, palmOne Zire 72, Sony Ericsson P900, and HP iPaq 4150
Crossfire achieves its platform independence through the AppForge's Booster Virtual Machine (previously known as MobileVB). Booster is analogous to the CLR in the .NET Framework. Crossfire applications require the Booster in order to execute. Booster takes up a mere .5MB to 1.3MB of storage space, depending on the target device. On my Zire 72, it has a footprint of .8MB.
Note that only VB.NET and VB6 are supported in Crossfire, and Booster supports most of the commonly used functions in VB.NET.
After installing Crossfire, Visual Studio .NET 2003 will add a new Crossfire Application template in the Visual Basic project type (see Figure 2).
Figure 2. The new Crossfire application template
You will then select a platform for which you want to develop (see Figure 3).
Figure 3. Select the target platform
You will see the familiar IDE (see Figure 4).
Figure 4. Using the Visual Studio .NET 2003 IDE to develop a Crossfire application
As in most .NET applications, you drag and drop controls onto the form. Crossfire includes a comprehensive list of controls in the Toolbox (see Figure 5).
Figure 5. The built-in controls of Crossfire (right-click to add more controls)
I have populated my form with some of the built-in controls (see Figure 6). It is identical to developing a .NET Compact Framework application.
Figure 6. Populating the form with AppForge controls
Besides the normal controls that you would expect to see in a mobile application (such as Button, Label, ListBox, etc), Crossfire also includes some interesting controls. Some controls that caught my attention are:
Figure 7. Using the SignatureCapture control for user signature
While you are not able to use the controls provided in the Windows Forms (only AppForge controls can be used), you can use the MainMenu control (in the Windows Forms) to create a menu (see Figure 8).
Figure 8. Using the MainMenu control in the Windows Form
When deployed on a Palm device, the menu looks like that shown in Figure 9.
Figure 9. The menu on the deployed application
There are three ways to test an application:
F5and test the application on a Windows form. This is the most elementary form of testing and is useful for functional testing, but not ideal for testing the user interface.
Figure 10. Configuring Crossfire to use an emulator for testing
For this article, I have tested my application on a palmOne Zire 72. As Crossfire applications require the Booster in order to work, you need to first of all install the Booster on the device. You can install it via the AppForge menu (see Figure 11).
Figure 11. Installing the Booster on the device
Once the Booster is installed, you can now deploy the application to the actual device (see Figure 12). The icon next to the platform name indicates that the device is designed for that particular platform, but you can still deploy it to the other platforms (although it is not guaranteed to work).
Figure 12. Deploying the application to a device
If you are deploying a Palm application for the first time, you need to supply a Creator ID (to learn more about the Creator ID, visit the URL shown in the dialog window, as shown in Figure 13. For this example, I just enter four random characters.
Figure 13. Setting a Creator ID for your application
To copy the application onto the device, perform a HotSync on your device. The application (DeliveryApp) now appears in the device (see Figure 14).
Figure 14. The DeliveryApp application deployed on the Palm Zire 72
Crossfire also supports building installation files for the various platforms (see Figure 15). For example, Crossfire builds .prc files for the Palm platform.
Figure 15. Building installation files for the various platforms
Crossfire ships with six sample applications illustrating several techniques in using Crossfire running on multiple device platforms. Here are the six (descriptions are from the documentation):
I think Crossfire has a lot of potential. With many device platforms on the market, developers are having a hard time trying to adapt their applications to run on the different platforms. Having a single code base able to run on multiple platforms is definitely a cost-saving proposition. Moreover, AppForge has cleverly leveraged on developer's familiarity with the .NET language (VB.NET, in this case) and spared developers the need to learn a more cryptic language such as C++. If you have not tried Crossfire yet, get a 30-day evaluation from www.appforge.com.
Wei-Meng Lee (Microsoft MVP) http://weimenglee.blogspot.com is a technologist and founder of Developer Learning Solutions http://www.developerlearningsolutions.com, a technology company specializing in hands-on training on the latest Microsoft technologies.
Return to ONDotnet.com
Copyright © 2009 O'Reilly Media, Inc.