222 Chapter 5 • Wireless Development Kits a result of how the SmartPhone Emulator is actually viewing each file internally, and the messages should probably be ignored. The SmartPhone Emulator also has variable debugging capabilities. Let’s create a more complex WML deck and see how variables are handled. Save this as c:\wap\vartest.wml: <?xml version="1.0"?> <!DOCTYPE wml PUBLIC "-//WAPFORUM//DTD WML 1.1//EN" "http://www.wapforum.org/DTD/wml_1.1.xml"> <wml> <card id="home" title="SmartPhone Emulator demo"> <p> Name: <input type="text" name="name"/> </p> <do type="accept"> <go href="#showname"/> </do> </card> <card id="showname" title="My name is "> <p> Hello $name. Welcome.</p> </card> </wml> Let’s look at this in the Ericsson R380. Select it from the workspace pane on the top left, then load the file via the menu bar.The Ericsson R380 is a touch- screen device, so click your mouse between the angle brackets (< >) to bring up the text entry screen.Type in consuelo and then click on the arrow icon in the bottom-right corner of the emulator display.You will be taken back to the first page, but consuelo will appear between the angle brackets now. Click Accept, and the resulting screen simply repeats the entered name along with a message. Now we can pull up the variable window. Select the View | View Variables menu option, and a new window will appear (see Figure 5.32). You can keep this window open to track the status of your variables as you browse with the emulator.This window also shows your browse history and status messages from the browser. www.syngress.com 159_wi_wg_05 10/22/01 4:35 PM Page 222 Wireless Development Kits • Chapter 5 223 www.syngress.com Figure 5.32 Yospace SmartPhone Emulator Variable Window 159_wi_wg_05 10/22/01 4:35 PM Page 223 224 Chapter 5 • Wireless Development Kits Summary You can choose from many available WAP SDKs. Finding the right one can be an extremely difficult and time-consuming task. Each SDK has its strengths and weaknesses, but you can use this to your advantage.You may find yourself using one SDK for your normal development, and each of the other ones at different times when it proves advantageous. Users of operating systems besides Microsoft Windows variants have one choice: the Yospace SmartPhone Emulator.The good news is the SmartPhone Emulator does many of the tasks that other SDKs do, and it reports errors better than the rest.The bad news is that it is the only one that costs money! The Nokia WAP Toolkit provides great error feedback and editing of WML,WMLScript, WBMP image files as well as variable viewing editing and timer status in the running browser.The downside is that it requires separate downloads for each real-world device you want to emulate.The Openwave UP.SDK is very simple, but it provides a large amount of feedback and is a native Windows application, which gives it a performance edge over the Java-based emulators.The Ericsson WapIDE provides project management features that allow you to quickly open and edit groups of WML and WMLScript files.The Motorola Mobile ADK pro- vides a completely integrated environment that integrates with source control software and supports other mobile technologies such as VoiceXML. Whatever SDK you choose, you will be pleased with the amount of time and work you save over developing and testing applications using your mobile handset, and the ease of developing and testing WAP applications on your home computer. Solutions Fast Track The Openwave UP.SDK 4.1 The UP.SDK provides emulation for a variety of mobile devices.You can use it to test your application on a variety of phones from multiple device manufacturers as long as they use the UP.Browser in their phones. You can download the UP.SDK from the Openwave Developer Program Web site (http://developer.openwave.com) in the Downloads section. www.syngress.com 159_wi_wg_05 10/22/01 4:35 PM Page 224 Wireless Development Kits • Chapter 5 225 The UP.SDK does not provide any text editing or IDE-style capabilities. It is useful for testing applications only, and you must have a separate program to create and edit your WAP files. The error messages reported by the UP.SDK are fairly helpful in finding syntactical problems.They will point you in the correct direction but are not explicit enough to make finding errors a simple task. The Nokia WAP Toolkit 2.1 The WAP Toolkit provides a prototype-like mobile phone for development. You can download modules that emulate actual Nokia phones from the Forum Nokia Web site (http://forum.nokia.com). The WAP Toolkit is a full-featured IDE.You can create and edit WML and WMLScript files as well as WBMP images using the built-in tools. The error messages reported by the WAP Toolkit are geared more towards machines than humans, but the line numbers they report are usually very close to the source of the problem. The Motorola Mobile Application Development Kit 2.0 The Mobile ADK includes support for a large variety of Motorola mobile phones.The Mobile ADK is the only SDK we looked at that also supports voice applications through VoxML and VoiceXML as well as Microsoft ASP support. You can download the Mobile ADK from the Motorola Applications Global Network (MAGNET) Web site at www.motorola.com/devel- opers/wireless in the Tools & Downloads section. The Mobile ADK and Wireless IDE provide a complete development environment for your mobile needs.You can integrate with source control products and develop for a variety of environments using the same IDE. www.syngress.com 159_wi_wg_05 10/22/01 4:35 PM Page 225 226 Chapter 5 • Wireless Development Kits The error reporting in the Mobile ADK is entirely subpar when compared to the other SDKs.The only thing you will find out is that an error occurred with your file.You will have to do all the work of figuring out where the error actually is. The Ericsson Mobile Internet WapIDE 3.1 The WapIDE includes support for three Ericsson mobile phones.You can use the emulator independent of the environment for building and debugging applications, which provides a good mechanism to demo your WAP applications. You can download the Ericsson WapIDE from the Ericsson Developer Zone Web site at www.ericsson.com/developerzone. The WapIDE includes an Application Designer that helps you build WML decks that are syntactically correct as well as compile and debug the ones that aren’t. The error reporting is quite descriptive although the line numbers don’t tend to match up that well. Also, it displays a lot of error messages for one error (three in our case), which makes tracking down problems a little more difficult. The Yospace SmartPhone Emulator 2.0 The SmartPhone Emulator can emulate a variety of mobile devices from a large variety of manufacturers.Viewing source files in multiple emula- tors—either individually or at the same time—is quite easy with the layout of the SmartPhone Emulator. It is also written entirely in Java, making it the only emulator that you can use on operating systems other than Microsoft Windows. You can download the SmartPhone Emulator from the Yospace Web site (www.yospace.com) in the Products section. The SmartPhone Emulator includes no editing capabilities, but it does provide good debugging facilities for viewing variables, history stacks, and other portions of the running WAP browsers. www.syngress.com 159_wi_wg_05 10/22/01 4:35 PM Page 226 Wireless Development Kits • Chapter 5 227 The error reporting is the most accurate of the group. It pinpoints the cause of the problem rather than the effect.The error messages are clut- tered with a lot of information pertaining to the internal implementa- tion of the SmartPhone Emulator, which makes finding the actual error message a little difficult. Once you do find it however, it points you directly to the error. Q: I’ve tested my application in all the SDKs and it works—but I can’t get it to work on my phone.What’s wrong? A:The SDK provides emulation of the actual phone, but it is not perfect. Remember from Chapter 2 that the gateway sits in the middle and can cause incompatibilities to show up in your WML code.The WAP gateway that your network provider is using could be causing the problem. Unfortunately, you are basically left with trial-and-error to figure out what the problem is.You can hire a WAP testing company to figure it out for you if you’d like. Q: Every SDK but the UP.SDK is written in Java, so why is the Yospace SmartPhone Emulator the only one I can run on my Linux machine? A:You can find directions on the Internet for getting an older version of the Nokia WAP Toolkit to run under Linux, but you will lose a considerable amount of performance. Many of the slower operations have been written in native code to make the SDK performance better. Unfortunately, you will have to convince the other manufacturers to release a pure Java version to get it running under Linux. www.syngress.com Frequently Asked Questions The following Frequently Asked Questions, answered by the authors of this book, are designed to both measure your understanding of the concepts presented in this chapter and to assist you with real-life implementation of these concepts. To have your questions about this chapter answered by the author, browse to www.syngress.com/solutions and click on the “Ask the Author” form. 159_wi_wg_05 10/22/01 4:35 PM Page 227 159_wi_wg_05 10/22/01 4:35 PM Page 228 Web Clipping Solutions in this chapter: ■ What Is Web Clipping? ■ What Types of Hardware Support Web Clipping ■ Working with the Palm OS Emulator ■ Creating a Web Clipping Project with the Web Clipping Application Builder ■ Web Clipping Basics and Examples Summary Solutions Fast Track Frequently Asked Questions Chapter 6 229 159_wg_wi_06 10/22/01 4:37 PM Page 229 230 Chapter 6 • Web Clipping Introduction One of the most interesting and challenging aspects about the evolving wireless Internet is the plethora of devices that are capable of browsing Internet content. These devices range from phones capable of using Wireless Application Protocol (WAP), to pagers capable of sending and receiving e-mails, to handheld Personal Digital Assistants (PDAs) with wireless modems or native connectivity.All of these devices feature different capabilities, interfaces, and usage patterns.They each require a different toolkit with which to craft your Web sites and applica- tions, and each operate under a slightly different set of rules in regards to usability. In this chapter, we will focus on the tools and methods used to deliver con- tent to the last category of devices mentioned, the PDA. In particular, we will discuss the proprietary Web clipping network that allows Palm-compatible hand- held devices to access Internet content.These devices do not necessarily have to be manufactured by Palm, but Web clipping, by definition, is restricted to Palm- compatible devices such as the Handspring Visor, Sony Clie, Qualcomm PDQ, or the Kyocera smart phone.There are slight differences between these devices, but in this case, fortunately, the differences are minimal, and have more to do with the network that the device uses to connect to the Internet than the device itself. This chapter is not intended to be a comprehensive reference on all of the intricacies all of the aspects of developing Web clipping applications (WCAs), nor is it a guide to programming native Palm OS applications. Rather, it is written as an introduction to the technology, and will provide information useful to Webmasters interested in deploying WCAs.The skills used to develop a WCA are skills that you most likely already have, namely, understanding of HTML and some experience with server-side scripting. If you are interested in a more in- depth coverage of this topic, you may want to read the Palm OS Web Application Developer’s Guide, available from Syngress Publishing at www.syngress.com. First, we will provide a definition and an overview of Web clipping, including the various components that must interact in order for content to be retrieved from a server.We will then cover the devices that can support Web clipping and the additional connection hardware and networks that are used to connect a handheld device to the Internet. Once we’ve explained the basics of what Web clipping is and the variety of ways you can connect a Palm-compatible organizer to the Internet, we will move into the development environment and discuss how to install the Palm Operating System Emulator (POSE) on your desktop computer.This program will allow you to test your application and its interaction with your Web server without www.syngress.com 159_wg_wi_06 10/22/01 4:37 PM Page 230 www.syngress.com owning or having access to an actual Palm-powered handheld.We will then dis- cuss how to install the Web Clipping Application Builder provided by Palm and walk you through the creation of your first WCA using this development tool and the POSE. We will then examine what aspects of HTML are and are not supported within the context of Web clipping. Specifically, we will examine the subset of HTML that can be used to build Web clippings, and the differences between the ways that your code will look and act on a handheld device versus a desktop computer.We will also cover some handy device-specific functions that are unique to Web clipping. Later in the chapter, we will cover several examples that illustrate what you can do within a WCA, and how these capabilities contrast with how you may be accustomed to programming for the Web.We’ll demonstrate how you can imple- ment some familiar features in a new environment, and provide examples of how to send data to and retrieve content from a Web server on the Internet using a WCA. What Is Web Clipping? First things first:Web clipping is not Web browsing. Forget the metaphor of “surfing the Web” as you know it from the desktop computing world.That being said, what is Web clipping? Web clipping refers to a proprietary system that allows handheld devices run- ning the Palm Operating System (version 3.5 or higher) to access the Internet using compiled content that resides on the device.This content is first authored in Hypertext Markup Language (HTML) and then converted to a special type of file called a Web clipping application (WCA) that can be installed on the device. WCAs can contain most of the common elements of the earlier versions of Web sites, such as links, forms, and images.The HTML markup used to create a WCA is a subset of HTML 3.2, containing only the elements suited to an environment with little processing power and memory.This subset of HTML is called Compact HTML (cHTML). A Web clipping application provides a means for your users to access your site or a Web application from their handheld device.There are pros and cons to this situation.An advantage is that you can distribute several HTML pages that can send data to your Web server from the field. On the other hand, you must put some extra effort into making sure that you include the relevant elements for your users before deploying your Web application. Once a WCA is installed on the Web Clipping • Chapter 6 231 159_wg_wi_06 10/22/01 4:37 PM Page 231 . this in the Ericsson R380. Select it from the workspace pane on the top left, then load the file via the menu bar .The Ericsson R380 is a touch- screen device, so click your mouse between the angle. brackets (< >) to bring up the text entry screen.Type in consuelo and then click on the arrow icon in the bottom-right corner of the emulator display.You will be taken back to the first page,. messages reported by the WAP Toolkit are geared more towards machines than humans, but the line numbers they report are usually very close to the source of the problem. The Motorola Mobile Application