Mining Google Web Services: Building Applications with the Google API

An important consideration for this chapter is that Google offers data in response to a request. Handling the input and output is up to you. One of the problems that developers must solve when working with mobile devices is testing for multiple models. Unlike desktop systems, it's not always easy to determine whether an application will provide the correct presentation on a mobile setup. Each mobile device has different capabilities, installed software, and a host of other problem areas for the developer to consider.

Most developers turn to emulation software to help test their applications. An emulator provides the equivalent environment of the mobile device that it's supposed to model. I stress the word equivalent, because most of these emulators don't provide a complete picture of the mobile device environment. You can rely on an emulator to tell you whether the application fits within the screen area that the mobile device provides, but you can't rely on it to tell you about memory issues or whether a particular device has a piece of support software you need. (Some emulators, such as the one provided with Visual Studio .NET, are getting better about testing memory issues ” vendors are aware of many of the emulator issues that developers face and are providing emulator support for these needs.) These other issues require testing on an actual device ”something you should do for at least a subset of the mobile devices you want to support.

Tip  

You don't need to buy every mobile device on the market ”emulators can help you keep your costs under control. However, you should buy the devices that people in your organization use most often. Actual device testing is better than using emulators, but you can rely on emulators to help when your application won't be used by a particular mobile device very often.

The following sections describe four emulation software options. The first option is the built-in support that Visual Studio .NET 2003 provides. If you don't plan to use this IDE, you can skip the first section.

Tip  

Keep apprised of the latest Microsoft mobility and embedded system developments at http://msdn.microsoft.com/mobility/. This Web site includes many of the links you'll need to download the latest Microsoft products to make your Google Web Services mobile application development easier.

I chose these options because they provide a broad range of support, and you can download at least evaluation units of all three emulators. Here are the download locations so that you can get your copies of the products before you begin this section. The following sections assume that you've downloaded the software required for the installation.

Tip  

You can also download the Microsoft Smartphone 2003 emulator at http://www.microsoft.com/downloads/details.aspx?familyid=8fe677fa-3a6a-4265-b8eb-61a628ecd462. This emulator requires eMbedded Visual C++ 4.0. The Microsoft eMbedded Visual Tools 3.0 (2002 edition) package does contain the Smartphone 2002 emulator. Likewise, you can find the Microsoft Pocket PC 2003 emulator for eMbedded Visual C++ 4.0 at http://www.microsoft.com/downloads/details.aspx?FamilyId=9996B314-0364-4623-9EDE-0B5FBB133652.

Visual Studio .NET Built-in Emulator

Visual Studio .NET 2003 comes with a built-in emulator you can use for various kinds of development. When you create a mobile project, the IDE automatically sets up the required emulator support as well. After you develop the application, use the Debug Start command to display the Deploy PocketPC dialog box shown in Figure 9.1.

Figure 9.1: Use the options in this dialog box to choose a deployment option.

To use the emulator, simply select the Pocket PC 2002 Emulator (Default) option and click Deploy. The IDE will copy the application to the emulator folder, start the emulator, and load your application. At this point, you can begin testing the application as you would any another .NET application.

The emulator is configurable. Use the Tools Options command to display the Options dialog box. Select the Device Tools Devices option to display the list of devices available for this project. Select the device you want to configure and click Configure. You'll see a Configure Emulator Settings dialog box similar to the one shown in Figure 9.2.

Figure 9.2: Configure the emulator to better model the mobile device you want to use.

You can change features such as the display size and color depth. More importantly, you can set memory restrictions on the System tab so that the application can model the memory restrictions of the target device to an extent. Note that the default Visual Studio .NET setup has a number of emulators including the Pocket PC and Windows CE devices.

Tip  

Microsoft recently released the Visual Basic .NET Resource Kit, a must-have addition for mobile development. The kit offers additional samples and makes it much easier to create robust mobile applications. Learn more about this kit at http://www.microsoft.com/downloads/details.aspx?FamilyId=EF4289B4-FFCB-40BD-9BFE-95256ABD0E13.

Microsoft eMbedded Visual Tools

The Microsoft eMbedded Visual Tools option is free. All you need to do is download the product and unpack it into an installation directory. You have a choice of two versions on the Internet right now, but the URL at the beginning of this section points to the latest version of the product. Developers have reported fewer problems with the newer version of the emulators and it does model the device more accurately.

Earlier versions of the product create two folders: one named Disk1 and a second named Disk2 . If you have an earlier version of the product, the Disk2 folder contains the three emulators and you can install them individually if desired by using the Setup program found in the individual emulation product folder. For example, if you want to install just the Pocket PC emulation, you can double-click the Setup program in the \Mobile Development Tools\DISK2\PPC12SDK folder. If you're using Visual Studio .NET 2003 or a language such as PHP for development purposes, you only need to install these emulators. You also need the Microsoft Mobile Internet Toolkit ( http://www.microsoft.com/downloads/details.aspx?familyid=ae597f21-b8e4-416e-a28f-b124f41f9768) when you use an older version of Visual Studio .NET. Users of older versions of Visual Studio will need to install the whole package, including the supplied language products.

Note  

The older versions of the emulators have a few problems. For example, the handheld PC emulation will sit in the upper left corner of your display and not move. However, it does provide a good environment in which to test your mobile application. Another potential problem with these emulators is that you can only run one of them at a time. Make sure you close an existing emulator before you start a new one. Generally, the new emulator will check for this problem and tell you to close the existing emulator. We'll discuss other emulator issues as the chapter progresses.

The latest version of Microsoft eMbedded Visual Tools uses a self-extracting executable. When you start the application, it unpacks the contents of the executable into a temporary folder. It then displays a series of dialog boxes that help you install eMbedded Visual Tools 3.0, Microsoft Windows SDK for Pocket PC 2002, and Microsoft Windows SDK for Smartphone 2002. The newer version only includes the Pocket PC and Smartphone emulators ”you can separately download SDKs for the handheld and palm size emulators found in the older version of Microsoft eMbedded Visual Tools at http://msdn.microsoft.com/downloads/list/handheldpc.asp. The Smartphone SDK is only available for eMbedded Visual C++, so make sure you install this language if you want to create a Smartphone application.

When you finish installing everything, it's important to test each of the emulators to ensure you received a good installation. Open one of the sample projects to test the emulator when using the newest version of Microsoft eMbedded Visual Tools. If one of these emulators fails, rerun the setup program and select just that emulator for a reinstall. You need to run each emulator separately when using the older products. If one of the emulators fails to work, you can always uninstall just that emulator using the appropriate entry in the Add/Remove Programs applet. Reinstall the emulator using the required Setup program for that emulator in the Disk2 folder. Figure 9.3 shows a typical Smartphone emulation.

Figure 9.3: Test each of the emulators to ensure they work.

OpenWave SDK

Like the Microsoft emulators, the Openwave SDK is also a free download, but the Open-wave Web site offers plenty of opportunity to purchase products as well. The Openwave file you download is an executable, so double-clicking it starts the installation process. Simply follow the prompts to install the product. Most versions of the product require yes or no answers to each question.

The Openwave Web site offers a number of versions of the product. I suggest you download the latest version of the product to ensure you get the latest features. However, the 5.1 version is also very capable and it includes a number of features not found in the 6.2.2 version used for this chapter. Figure 9.4 shows some of the optional features you can install with the 5.1 version. If you want to use Openwave as your development platform, you might want to download the 5.1 version (or both versions). The 6.2.2 version is most useful as an emulator only.

Figure 9.4: Select custom options as needed for your emulator setup.

Once you get Openwave installed and have restarted your machine, you'll want to test this product. If you installed the 6.2.2 version, all you get is the emulator. To start the emulator, select the Start Programs Openwave SDK 6.2.2 Openwave SDK 6.2.2 HTTP option. You'll see an emulator similar to the one shown in Figure 9.5. The emulator automatically goes to the Openwave test site on first use, but you can change that location by opening the SDK Configuration dialog box using the Tools Options menu. Select the Browse tab and change the Homepage field.

Figure 9.5: Using the Openwave emulator means starting the associated IDE and entering an URL using a menu command. Image courtesy Openwave Systems Inc.

As previously mentioned, Openwave SDK 5.1 has more to offer than other versions of the product. Unlike some of the other emulators you'll use, this one is actually part of a development IDE. Select the Start Programs Openwave SDK 5.1 Openwave SDK 5.1 option to open an IDE similar to other IDEs you may have used in the past. However, for this book, the important feature is the emulator that appears in the right side pane. To use this feature, you'll need to use the Simulator Go to Address command, enter an URL in the Go to Address dialog box, and then click OK. Figure 9.6 shows a typical example of the Openwave emulator within the IDE.

Figure 9.6: Use the 5.1 version if you need an IDE in addition to the emulator. Image courtesy Openwave Systems Inc.

Smartphone

The Smartphone emulator is one of the timed usage options you can try. After you download the product, you can try it for anywhere from 5 to 15 days free (depending on the version you download), at which time your license will expire and the product will cease working. The Smartphone emulator is in a Zip that you download and unpack to a temporary folder. To start the installation process, double-click the setup application that appears in the Zip file (the actual name varies by Smartphone version number). Follow the prompts to install the product.

Now that you have the product installed, you can test it to see if it works. The first time you start this product, you'll see a dialog that requests your licensing details. This dialog box accepts your name, email address, and the key that you were sent in your email. (The company sends this key after you download the product from their Web site.) Make sure you use the information from the email because this step is quite picky.

You also have a choice of starting the product in Development or Display mode. The Development mode opens an IDE you can use to create applications. This mode also shows multiple forms of the emulation, as shown in Figure 9.7. These aren't the only emulators available. The number of emulation options provided surprised me ”they're all available on the Workspace Add Emulator menu. This product also uses the concept of an emulator group . Figure 9.7 shows the default emulator group. A single test sends the same input to all of the emulators in a group ”greatly reducing the time required for testing.

Figure 9.7: Create a complex emulator environment using the Smartphone Development mode.

The Display mode opens a single emulator, as shown in Figure 9.8. Use this option when you want to fine-tune the display details of your application. Most of the emulators have a full view and several zoomed views. Figure 9.8 shows a full view.

Figure 9.8: Fine-tune the display details and perform final testing using the Display mode.

Категории