1. Trang chủ
  2. » Công Nghệ Thông Tin

Webmaster''''s Guide to the Wireless Internet part 23 doc

10 209 0
Tài liệu đã được kiểm tra trùng lặp

Đang tải... (xem toàn văn)

THÔNG TIN TÀI LIỆU

Thông tin cơ bản

Định dạng
Số trang 10
Dung lượng 267,77 KB

Các công cụ chuyển đổi và chỉnh sửa cho tài liệu này

Nội dung

For our example, version 1.1 suffices, so we can delete the other declarations.We do not need a head element in our deck, so we can delete that comment.The default template provides a Ba

Trang 1

Accessing and Editing Local Files

You can use the Nokia WAP Toolkit to create, edit, and view files stored locally

on your computer Let’s create a simple WML file called hello.wml and save it in

the c:\wap directory First, select File | New | WML Deck from the menu bar, or press Ctrl+N on your keyboard A new WML deck will appear in the

editor with a large amount of skeleton code already filled in.This is great for the first couple of files that you write, but you will quickly find yourself deleting large portions of the skeleton files every time you create a new WML deck Let’s use the template and customize it to mimic our other examples

The WML deck defaults to WML 1.1, but has version 1.2 and 1.3 declara-tions commented out in the default file.You can use one of the other declaradeclara-tions

if your application requires features not available in version 1.1 of WML For our example, version 1.1 suffices, so we can delete the other declarations.We do not need a head element in our deck, so we can delete that comment.The default template provides a Back button for every card.The Nokia browser does not pro-vide backwards navigation by default, so if you do not place this functionality in the template section or in every card, users on Nokia phones will not be able to navigate to previous cards when viewing your application

Figure 5.9Nokia WAP Toolkit

Trang 2

The first card contains a quite a few comments that guide you through building your own card.The first thing we need to do is change the title Let’s

make the attribute read title=“Hello” instead of the default “Card #1.”We

aren’t going to add anything new to the card, but we can see where we would have to add elements such as <onevent>, <do>, and <timer> from the com-ments.We can remove these comments to make our final code cleaner.The default

<do> tag has a type attribute of unknown.We want this to be the default action,

so let’s change this so that it reads type=“accept” and leave the rest as it is.

We have a paragraph in card1 that has the text First Card in bold Let’s change

the text to be “Hello World!” and leave it bolded.We can leave the rest of the

deck as it is Our final example file now looks like this:

<?xml version="1.0"?>

<!DOCTYPE wml PUBLIC "-//WAPFORUM//DTD WML 1.1//EN"

"http://www.wapforum.org/DTD/wml_1.1.xml">

<wml>

<template>

<do type="prev"><prev/></do>

</template>

<card id="card1" title="Hello" newcontext="true">

<do type="accept" label="Next">

<go href="#card2"/>

</do>

<p align="center">

<big><b>Hello World!</b></big>

</p>

</card>

<card id="card2" title="Card #2">

<onevent type="ontimer">

<prev/>

</onevent>

<timer value="25"/>

Trang 3

<p align="center">

<big><b>Second Card</b></big>

</p>

</card>

</wml>

You need to save your file before the Toolkit can compile it, but let’s make

our lives easier by clicking the Compile button and letting the Toolkit prompt

us to save the file Save the file in c:\wap as nokia.wml and then you should see that it compiles with no errors.You need to compile your file before viewing with the Nokia Blueprint phone in order to see the latest version If you do not compile it, you will be viewing the last version that was compiled and your

changes will not be shown.You can now click the Show button, and your sample

file will appear in the Blueprint phone as shown in Figure 5.10

The Nokia WAP Toolkit provides a substantial amount of information about

the WML file you are currently viewing If you select the WML Deck tab along

the bottom of the Toolkit window, you will see the WML Deck that is currently loaded into the emulator in an Element Tree view—a tree representation of the WML file.You can choose from a variety of views including:

Figure 5.10Blueprint Phone with Our WML Deck

Trang 4

Original Source This is only available if you are viewing an uncom-piled WML file in the emulator If you compile your file before viewing

it or you are retrieving it through a gateway, this option will not appear

Decoded WML The WML source represented by the Compiled Wireless Markup Language (WMLC) file the emulator received.This will not have any of the comments and will more than likely be indented differently than the original file, but the functionality should be the same.This is handy when your source files are heavily commented for maintenance reasons and you just want to see the actual WML code

Bytecode The compiled version of the WML file.This is what the actual WAP devices will receive on the network.This is of little value except to determine the compiled size of the WML deck If you are developing WAP tools such as a gateway or WMLC decompiler, this is a useful view to have

Element Tree A tree representation of the WML file A quick and easy way to see the overall structure of your WML deck

The Nokia WAP Toolkit provides a large number of features that developers

of all types of WAP applications will find useful Not all of them may seem rele-vant at first, but chances are you will use each one of them during some point in your development cycle

Accessing Files through a Gateway

Nokia does not provide access to a WAP gateway through their developer pro-gram.You will have to download and install the Nokia Activ Server to access files through a Nokia gateway Interoperability is a large issue in the WAP world, so testing various WAP browser and gateway combinations is recommended Let’s use the Ericsson public gateway and the Nokia WAP Toolkit together

To change the WAP gateway, select Toolkit | Device Settings from the

menu bar.The Blueprint Device Settings dialog box will appear Check the radio

button labeled Use WAP Gateway Connection and enter the IP address of 195.58.110.201in the WAP Gateway Address text box.The Nokia WAP Toolkit with these settings is shown in Figure 5.11

The Nokia WAP Toolkit will not use the WAP gateway to access WML decks

on your local file system Only WML decks loaded from URLs will be retrieved through the gateway.You can continue to develop and test local files without set-ting the Toolkit back to HTTP Direct mode

Trang 5

Debugging Techniques

The Nokia WAP Toolkit has many advanced debugging features Let’s start off by looking at how it handles invalid WML Let’s remove the closing big element (</big>) from the first card in our nokia.wml file, so that the paragraph looks like this:

<p align="center">

<big><b>Hello World!</b>

</p>

Click Compile in the Toolkit window, and a dialog box pops up telling us that the source file contains two errors Click OK and use the error message box

that appears in the source editing window to review the errors, as shown in Figure 5.12

When you double-click on an error message, the cursor is placed on that location in the source file.The first error message says “Error: 3077,line:15, column:8 XML:name within end tag does not match with the start tag.” Line 15, column 8 is in the middle of our </p> element.The error message isn’t very explicit about what it was expecting, but it does tell us that it was expecting something other than a paragraph element to be closed.We know it is the big element, and if we put the </big> element back into the source file, everything works as expected

Figure 5.11The Nokia WAP Toolkit Gateway Settings

Trang 6

The final error: “Error:3078,line:44,column:1 XML: pending content” of our example in this section does not make much sense Our source file is only 29 lines long This type of error message was common in C com-pilers and generally means that a close tag is missing somewhere in the file First, look into the error messages that point to actual line numbers, then recompile your deck—you will often find that the other errors were actually side effects of the more explicit errors.

We need a more complex WML file to see the advanced features.This WML deck isn’t very useful on a real WAP device, but it is useful for illustrating the debugging features of the Nokia WAP Toolkit

<?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="Toolkit demo" ontimer="#home">

<timer value="300"/>

<p> Hello $name Welcome </p>

</card>

Figure 5.12Invalid WML Error Message in the Nokia WAP Toolkit

Trang 7

When you open the file and show it in the Blueprint phone, you will notice that the status bar along the bottom of the Toolkit window counts down to the next timer event Figure 5.13 shows it along the bottom as well Debugging a timer is much easier when you see it counting down Otherwise, you just wait for a while and wonder if something is wrong with your code or if your com-puter is just slow!

Our deck does not set the name variable.We can do this through the toolkit

and see the results on the Blueprint phone Select the Variables tab along the

bottom of the Toolkit window to bring up the variable editing screen.We can add variables to the browser environment by entering the name and value and

clicking Set at the bottom-right of the window Let’s set up our variable by set-ting Name to name and Value to phyllis as shown in Figure 5.13.

Once you click the Set button, you will notice that the deck is updated in the Blueprint phone Let’s change the value to darrell and click Set again.You’ll

notice that the Toolkit automatically updates your application when you change variables.You can alter variables and debug your application without going through the tedium of actually reloading the deck every time using the Nokia WAP Toolkit

Figure 5.13Advanced Debugging Features of the Nokia WAP Toolkit

Trang 8

The Motorola Mobile Application Development Kit 2.0

The Motorola Mobile Application Development Kit (Mobile ADK) supports the widest variety of mobile standards of any of the SDKs we have covered here.The Mobile ADK supports the following mobile technologies:

Motorola phones

The Mobile ADK relies on the Motorola Wireless IDE for many of its fea-tures.The two packages provide a complete development environment with proj-ect management, source control integration, and error tracking

Installing the Motorola Mobile ADK

The Mobile ADK is written in Java for the Win32 platform—this includes

Windows 9x,Windows NT, and Windows 2000.The installation may require you

to install additional software from Microsoft if you do not have the appropriate Java Virtual Machine already installed on your computer.We cover the specific requirements for your system, how to obtain the software, and how to install the Mobile ADK on your computer

The Mobile ADK requires that the Motorola IDE be installed before you can use it.You can use both applications separately from each other, but they must both be installed for the Mobile ADK to work

System Requirements for the Motorola Mobile ADK

Motorola gives the following requirements for running the Mobile ADK:

■ Microsoft JVM version 5.00.3186 or later (Microsoft JVM version 5.00.3234 or later for Windows 2000)

■ Microsoft Internet Explorer 5.0 (or later)

■ Service Pack 3 or later (required for Windows NT 4.0)

Trang 9

■ 80MB of free disk space

■ A video card that supports 1024x768 resolution and 16-bit color mode

■ A Windows-compatible sound card (required for running voice applications)

■ A compatible set of speakers and microphone (required for running voice applications)

Windows Me was not listed as a compatible platform, but we have success-fully installed and used it on that platform.The Java requirements are quite strict You cannot use the JDK from Sun to run the application Motorola requires the Microsoft JVM to function correctly

Microsoft Java Virtual Machine

You probably already have the Microsoft JVM installed on your machine.

Open Internet Explorer and select View | Java Console from the menu

bar If you do not have that option, you need to enable the Java console

by opening up your Control Panel and running the Internet Options applet Select the Advanced tab and scroll down the options until you find the Java Console Enabled option Check that box and restart your

machine You should now be able to pull up the Java console by

selecting View | Java Console and figure out what version of the JVM

you are running.

Upgrading your JVM is easy through Windows Update Select Start

| Windows Update from the Start menu and then choose Product Updates from the resulting Web page The Microsoft Java Virtual

Machine should be one of the packages available for you to download You can also download the latest version at www.microsoft.com/java if you do not want to use Windows Update.

Developing & Deploying…

Trang 10

Obtaining the Motorola Mobile ADK

You can download the Mobile ADK from the Motorola Applications Global Network (MAGNET) Web site at www.motorola.com/developers/wireless in the Tools & Downloads section.You have to register with Motorola before you can access the Mobile ADK Once you have registered and logged in to the site, click

on the Tools & Downloads section and then click on the link to the Mobile Application Development Kiton the next page Once you get to the page that actually lets you download the Mobile ADK, you will also find a link to the Wireless IDE.You must download and install this before you install the Mobile ADK.This is the largest SDK we look at, and it is unfortunate that the way Motorola initiates downloads is incompatible with many download managers that let you recover from a dropped connection

Download the Mobile ADK 2.0 after you have downloaded the Wireless IDE.The Wireless IDE filename is FlexIde_Ver_2_1_0_83_rel.exe and the Mobile ADK filename is MobileADK2_0.exe Motorola will also e-mail you a license key that you will have to enter during installation.We walk through installing both of these applications next

Installing the Motorola Mobile ADK

Run the FlexIde_Ver_2_1_0_83_rel.exe first.You will be greeted with the installation screen shown in Figure 5.14 Click Next to go to the next screen

that asks you where you would like to unpack the setup program.You can accept

the defaults and click Next to continue with the installation.

Figure 5.14Initial Install Screen for the Motorola Wireless IDE

Ngày đăng: 04/07/2014, 02:20

TỪ KHÓA LIÊN QUAN