Professional Documents
Culture Documents
Nokia Series Development Guide
Nokia Series Development Guide
ADNAN FAKHAR
4/16/2010
Document Revision History
Name Date Description Version
Table of Contents
Supported Development Environments and APIs......................................................................................................................5
The Series Developer Platform 2.0 SDK for Symbian OS – For MIDP supports usage of Unified Emulator Interface (UEI).........5
Supported APIs....................................................................................................................................................................... 5
MIDlet.................................................................................................................................................................................. 11
MIDlet lifecycle..................................................................................................................................................................... 12
startApp() Method......................................................................................................................................................12
pauseApp() Method....................................................................................................................................................12
destroyApp() Method.................................................................................................................................................13
MIDP User Interface APIs.....................................................................................................................................................13
HelloWorld MIDlet............................................................................................................................................................... 15
Development........................................................................................................................................................................ 35
Development........................................................................................................................................................................ 43
Development........................................................................................................................................................................ 53
Development........................................................................................................................................................................ 58
Development........................................................................................................................................................................ 61
Starting the IBM® WebSphere® Studio Device Developer for the first time...............................................................66
Configuring as a UEI Emulator Device........................................................................................................................67
Development........................................................................................................................................................................ 69
Audio Recording................................................................................................................................................................... 97
Getting started..................................................................................................................................................................... 98
Java..................................................................................................................................................................................... 102
http://www.forum.nokia.com/Technology_Topics/Development_Platforms/Java.xhtml.............................................105
FileConnection API and Personal Information Management (PIM) API (part of Optional
Packages JSR-75), and Nokia UI API.
The Series 80 MIDP SDK works as a plug-in with Nokia Developer’s Suite for J2ME™ and can also
be used with Java IDEs. The Series 80 MIDP SDK supports Unified Emulator Interface (UEI)
interface. IDE support includes Borland® JBuilder® 9 Mobile Edition, Borland® JBuilder® X Mobile
Edition, Sun Java™ Studio Mobility 6 2004Q3, Sun J2ME™ Wireless Toolkit 2.1, Eclipse 3.0 and
IBM® WebSphere® Studio Device Developer versions 5.6 and 5.7.
Together with the IDE, the Series 80 MIDP SDK provides functionality required for MIDP
application development, including API libraries, emulator, example MIDlets and user
documentation. The Series 80 MIDP SDK Emulator allows developers to run and test the behavior
of the MIDlet on your PC or Laptop. Emulator provides the graphical interface of a Nokia 9500
Communicator and device functionality to test MIDP applications.
1.1
7 It is recommended to install the IDE for the Java development before the Series 80 MIDP
SDK installation.
The Series 80 Developer Platform SDK emulator allows you to run and test the behavior of MIDP
applications on your PC before installing them on a real device. It provides the graphical interface
of a Nokia 9500 Communicator and device functionality to test your application.
1 Note that the emulator is only able to run applications packaged into a MIDlet Suite as
specified in the MIDP specification. This means that both a JAD file (Java Application Descriptor)
and a JAR file (Java Archive) must be created before running the application.
The Series 80 Developer Platform SDK emulator’s main window simulates the Nokia 9500
Communicator’s PDA interface without the keyboard. The emulator replicates the user interface
of the Nokia 9500 Communicator’s interface with respect to its soft-key definitions, menu
selections, and message display. You can use the PC keyboard and mouse to control the
emulator.
The appearance of the emulator is faithful to the appearance of the device, although the contrast
and color-rendering capabilities of each might differ slightly due to differences in monitor
calibration and imaging technologies.
The Desk contains application icons. In the emulator, applications are opened from the desk with the Open command button. When
an application is opened, the desk becomes the Application area . That is, the application is displayed instead of the desk.
To simulate pressing the buttons on a Nokia 9500 Communicator device, click the corresponding
command keys on the emulator window with the mouse. To access the PDA menu press F1. The
menu structure displayed in the emulator’s user interface is identical to that of the Nokia 9500
Communicator device, although not all menus in the Series 80 Developer Platform SDK work
identically to their device counterpart. For example, you cannot use a telephony application to
make a phone call on the SDK.
1.5
The following table lists the emulator function keys and keyboard shortcuts:
Key Function
1 Note: Symbian function keys 'Alt + F2' and 'F8' do not work in emulator. Window server shortcut keys 'Ctrl + Alt + Shift +
E/D/W/H' don't work in emulator. The tasklist key ‘Ctrl + Alt + Shift + T’ does not work in the emulator.
CBA buttons
The Command Button Area (CBA) on the right of the Application area correspond to buttons to
access key commands or functions within an application. The functionality of the Command
buttons is application-specific.
The command text is underlined if the Enter key has been assigned to that command. When a
command is dimmed, it cannot be used.
Figure 2: Command buttons in emulator
The following table shows the guidelines for usage of CBA buttons. Button number one is the
topmost command button.
While the Series 80 2.0 Developer Platform SDK Emulator simulates most of the behavior of the
Nokia 9500 Communicator device, there are some important differences between the emulator
and the real device.
1 • Telephony functionality is not fully supported in emulator. Therefore some applications are
not fully functional in emulator.
2 • The emulator does not contain the phone interface of the device; it simulates Nokia 9500
Communicator’s camera functionality with a separate Camera application.
3 • Nokia 9500 Communicator may support additional multimedia formats that are not
supported in the Series 80 Developer Platform SDK.
4 • Some hardware related features (such as SIM card related functionality) do not work in the
emulator.
5 • The emulator can imitate functionality, but it cannot fully reflect the timing responses of
the real device. Any kind of application that depends on timing or performance of the device
is not accurate on the emulator.
6 • The emulator simulates networking functionality using either an Ethernet adapter or a
wireless WLAN adapter. The network speed and performance are dependent on PC’s
hardware and the configuration of network adapters and thus deviate from real device.
7 • The emulator does not load all services upon initialization, whereas the real device does. To
load the services, such as Bluetooth, the application to be used must perform this task.
8 • The Bluetooth protocol stack and lower-level implementation are different in the emulator
and a real device. You cannot use WLAN and Bluetooth in the emulator at the same time.
9 • Emulator does not emulate the real memory size of a Nokia 9500 Communicator device.
10 • The emulator is a single process in the Windows environment. Even though all applications
mimic process behavior, they are actually implemented as threads in the emulator process.
This can affect applications that depend on process behavior, such as scheduling activity, and
resources such as memory that processes consume.
11 • All ports that the emulator simulates as being directly connected to the emulator device
are actually PC ports. The timing and performance of these ports are dependent on PCs
hardware and the configuration of Windows. As a result, any kind of real-time input/output
management is very difficult.
The Mobile Information Device Profile (MIDP) is a set of Java APIs that together with the
Connected Limited Device Configuration (CLDC) provide a complete J2ME application runtime
environment for mobile information devices (MIDs). The MIDP specifications (JSR-118) define
minimum hardware, software, networking, application requirements, as well as standard system
APIs for devices that support MIDP.
MIDP is intended for “connected” devices such as communicators and smartphones, which are
characterized by having limited Central Processing Unit (CPU), memory, keyboard, and display
capabilities.
For more details on MIDP and the related specifications, see http://java.sun.com/products/midp/ .
Connected Limited Device Configuration (CLDC) defines the Java language features and the core
libraries of the Java Virtual Machine (JVM).
For more details on CLDC and the related specifications, see http://java.sun.com/products/cldc/ .
MIDlet
Java applications developed with the SDK are called MIDlets. A MIDlet is an application, which
has been written for the Java 2 Micro Edition (J2ME) Mobile Information Device Profile (MIDP).
A simple example of a MIDlet is the HelloWorld example application provided with the SDK.
MIDlet lifecycle
MIDlets are designed to co-exist with other applications on a Mobile Information Device (MID).
The MIDlet lifecycle is pivotal in enabling this co-existence. Basically, a MIDlet can be in one of
the following states: paused, active, or destroyed.
The Application Management Software (AMS) controls the state of a MIDlet by directing a MIDlet
to start, pause, or destroy itself. It constructs a MIDlet and communicates changes in its state by
calling the following methods, which every MIDlet must implement: startApp(), pauseApp(), and
destroyApp().
All MIDlets start out in the paused state. When a user starts an application, the AMS calls the
startApp() Method of the MIDlet in question, after which the MIDlet is in active state (that is, the
application is opened).
3.1 startApp() Method
When users open a Java application on their device, the AMS calls the startApp() method. In this
case, the MIDlet is newly constructed with this method. In the case of such a newly constructed
MIDlet, the startApp() method should call Display.getDisplay(this).setCurrent(startup_screen) to
invoke the startup screen of the MIDlet (that is, application) in question.
The startApp() method is also invoked by the AMS when a MIDlet is returned from the paused
state. In this case, the startApp() method will typically need to restore the state it was in before it
was paused.
When users pause (but do not close) an application, the AMS calls the pauseApp() method. In
this case, the application is paused and it is no longer displayed in the User Interface (UI) to the
user. However, any threads or timers created by the MIDlet in question will continue to run
unless stopped manually. These threads keep on running by default, because the application will
need to restore its state when it is reactivated with the startApp() method.
3.3
When users close an application, the AMS calls the destroyApp() method. This method instructs
the MIDlet to release all the resources it has reserved and to close down as soon as possible. In
effect, this means that the application in question closes all input and output streams, terminates
all threads, and cancels all timers. Once the destroyApp() method has been called, the MIDlet
ceases to access the display, in other words, the application is no longer displayed in the UI to
the user.
The high-level API classes Alert, Form, List, and TextBox are extensions of the abstract class
Screen. These are designed to provide abstractions and components that are highly portable
across different Mobile Information Devices (MIDs), as the application takes care of aspects such
as drawing, font characteristics, navigation, and scrolling. A particular device’s implementation of
these classes performs the adaptation to its hardware and native UI look and feel.
The low-level API is based on use of the abstract class Canvas. In comparison with the high-level
APIs, this class allows applications to have more direct control of the UI by permitting greater
control of what is drawn on the display and reception of low-level keyboard events.
A Java archive (JAR) file contains the class files, resource files, and the manifest file for the J2ME™
application. JAR files can be either created manually with the Sun JAR.EXE utility, or can be
created using IDEs. One JAR file can contain one or more MIDlets. A JAR file that contains
multiple MIDlets is called a MIDlet suite. The Jar file is the application file which is downloaded to
Series 80 device.
All MIDlets are deployed to devices as suites. MIDlets in the same suite share the same
execution environment (virtual machine) and can interact with one another. Each MIDlet suite
JAR file has an associated Application Descriptor (JAD file) used to describe its contents. The
application descriptor MIME type is text/vnd.sun.j2me.app-descriptor. The file extension of such
an application descriptor must be .jad. The application management software (AMS) uses the
descriptor to manage each MIDlet included in the suite, that is, to verify that a MIDlet is suited
for execution on the device before loading the MIDlet suite JAR file. The JAD file contains the
attributes for the AMS, as well as the application-specific attributes the MIDlet suite itself will
use.
The MIDP 2.0 specification defines the rules for the using the attributes. You can specify
attributes in both the descriptor and the manifest. Attribute names that begin with “MIDlet-“ or “MicroEdition-“ are
reserved and used by the AMS.
The following table shows you where each attribute may or must appear:
(1
Must occur in manifest or descriptor, it may appear in either, but it is not optional
(2
Same as the System property microedition.profiles
(3
Same as the System property microedition.configuration
(4
<m> is an integer, starting at 1 and incremented by 1 for each MIDlet
(5
<n> is an integer, starting at 1 and inceremented by 1 for each Push Registry entry
5 HelloWorld MIDlet
This section describes the general structure and design of the simple HelloWorld application.
The HelloWorld application is a simple MIDlet included with the SDK as an example application.
When opened, the application displays a ‘Hello World’ message on the display of the device.
Selecting the Exit command closes the application.
Figure 3: Hello World application
The HelloWorldMIDlet class extends the javax.microedition.midlet.MIDlet class. It uses the MIDP
high-level API javax.microedition.lcdui.TextBox class to enter and edit text, in this case, ‘Hello
World’.
The TextBox class extends the abstract class Screen, which, in turn, extends the abstract class
Displayable. The TextBox UI component has a string contents area that allows users to enter and
edit text.
The HelloWorldMIDlet class also implements the CommandListener interface used to receive
user input from the command area.
The functionality of the HelloWorldMIDlet is the following: The startApp() method sets the
MIDlet’s current Display to the HelloWorldMIDlet object, if a current display does not already
exist. If the HelloWorldMIDlet object receives an Exit command from the user interface, it calls
the commandAction() method of the HelloWorldMIDlet. The HelloWorldMIDlet then handles the
MIDlet state transition to a Destroyed state. See below for the HelloWorldMIDlet.java example
code.
package com.nokia.examples.lcdui.helloworld;
import javax.microedition.midlet.*;
import javax.microedition.lcdui.*;
/**
* This class illustrates the implementation of a simple MIDlet that initially
* displays a "HelloWorld!" message to the screen and allows the user to edit
* that message.
* <p>
* This class extends the class javax.microedition.midlet.MIDlet. It
* creates and maintains references to a TextScreen object and a
* TextEditor object.
* <p>
* Note that the HelloWorldMIDlet class has no constructor. MIDlet
* contructors are not required to do anything because intializing of the
* object is better performed in the startApp() method.
*
* @author Nokia Corporation
* @version 1.0
*/
public class HelloWorldMIDlet extends MIDlet {
/**
* Creates an instance of TextScreen if one has not already been
* created and tells the framework to set this instance of TextScreen
* as the current screen.
*/
public void startApp() {
if (display == null) {
// First time we've been called.
display=Display.getDisplay(this);
textScreen = new TextScreen(this, "Hello World!");
}
display.setCurrent(textScreen);
}
/**
* This must be defined but no implementation is required because the MIDlet
* only responds to user interaction.
*/
public void pauseApp() {
}
/**
* No further implementation is required because the MIDlet holds no
* resources that require releasing.
*
* @param unconditional is ignored.
*/
public void destroyApp(boolean unconditional) {
}
/**
* A convenience method for exiting.
*/
public void exitRequested(){
destroyApp(false);
/*
* notifyDestroyed() tells the scheduler that this MIDlet is now in a
* destroyed state and is ready for disposal.
*/
notifyDestroyed();
}
/**
* Implements the transition from the TextEditor screen to the TextScreen screen.
*
* @param string is the new text to be displayed. It is null if the text is
* not to be changed.
*/
public void textEditorDone(String string) {
if (string != null) {
textScreen.setCurrentText(string);
}
display.setCurrent(textScreen);
}
/**
* Implements the transition from the TextScreen screen to the TextEditor screen.
*/
public void textEditorRequested() {
String currentText = textScreen.getCurrentText();
if (textEditor == null) {
textEditor = new TextEditor(this, currentText);
} else {
textEditor.setText(currentText);
}
display.setCurrent(textEditor);
}
}
Example 1: HelloWorldMIDlet.java
In addition to the above, familiarity with the basics of wireless communication is also
recommended.
You should have the following tools and resources available on your PC before you can start to
develop Java MIDP applications using the Series 80 MIDP SDK:
1 • Microsoft Windows XP with Service Pack 2 or Microsoft Windows 2000 with Service Pack
3
2 • Java 2 Standard Edition (J2SE) SDK version 1.4.1_02 or higher The J2SE SDK provides the
Java compiler and other tools used in application development. You can download the J2SE SDK
at http://java.sun.com/j2se
3 • The Series 80 Developer Platform 2.0 SDK for Symbian OS – For MIDP installed on your
PC
4 • A text editor, such as WordPad
2 You can develop applications and view them in the emulator with a minimal development
environment, that is, by using a simple text editor and command prompts. Application
development in this minimal development environment does not call for configuring the
emulator. Instead of the minimal development environment described in the Getting Started
section, you might wish to use a more robust and user-friendly development environment, such
as Borland JBuilder or Sun J2ME™ Wireless Toolkit.
When you start developing an application for the first time with the Series 80 Developer Platform
2.0 SDK for Symbian OS – For MIDP, you should first check that the development environment is
set up properly. This involves, for example, checking that the paths for the Java compiler and
preverifier tool are set correctly. This section provides instructions on how to test and
troubleshoot the needed path settings.
You can run the SDK without setting the PATH variable. However, setting the PATH variable
allows you to run the executables (javac.exe, preverify.exe) from any directory without having to
specify the full path to the executable every time you run it. See section 5.3.2, “Troubleshooting:
PATH variable not set or not set correctly” for detailed instructions on how to set the path.
Checking the paths for the Java compiler and preverifier tools
1 1. To check the Java compiler (javac.exe) settings, enter the following command in the
Command Prompt:
2 javac
You should get the following output on the screen:
If you get an error message, see section 5.3.2, “Troubleshooting: PATH variable not set or not set
correctly”.
3 2. To check the preverifier tool (preverify.exe), enter the following command in the
Command Prompt:
4 Preverify
If you get an error message, see section 5.3.2, “Troubleshooting: PATH variable not set or not set
correctly”.
When testing the application environment settings, you may get the following error message:
“The name specified is not recognized as an internal or external command, operable program or
batch file” (Windows 2000, XP) .
This means that Windows cannot locate the Java compiler (javac.exe) or the preverifier tool
(preverify.exe). See examples below on how to specify their locations for Windows.
Example 1: To specify the location of the Java compiler: If you installed the Java 2 Software
Development Kit in, for example, C:\jdk1.4, enter the following command in the Command
Prompt:
C:\jdk1.4\bin\javac
Example 2: To specify the location of the preverifier tool:
C:\Nokia\Devices\S80_DP2_0_MIDP_SDK\bin\preverify
Note that in this case each time you compile or preverify an application, you have to precede
your javac and preverify commands with C:\jdk1.4\bin\ or
C:\Nokia\Devices\S80_DP2_0_MIDP_SDK\bin\, such as, j2sdk1.4.2_<version>\bin\javac
MyClass.java. To avoid this, update the PATH variable as instructed in the following section.
To avoid having to enter the full path every time you need to compile or preverify a MIDlet, it is
useful to set the path permanently so it will persist even after rebooting. This is done by adding
the full path of the directory to the PATH variable. Typically, this full path is
C:\j2sdk1.4.2_<version>\bin for the Java compiler and
C:\Nokia\Devices\S80_DP2_0_MIDP_SDK\bin for the preverifier.
Complete the following steps to set the path permanently on Microsoft 2000 and XP:
5 1. Choose Start > Settings > Control Panel > System
6 2. Go to the Advanced tab and select Environment Variables
7 3. Locate the Path variable in the User Variables or System Variables If you are not sure
where to add the path, enter it as the last Path variable value listed in User Variables.
8 4. Select the Path variable and click Edit
9 5. Enter the path into the variable value field, for example, as follows:
C:\j2sdk1.4.2_<version>\bin for the compiler C:\Nokia\Devices\S80_DP2_0_MIDP_SDK\bin for
the preverifier
10 Warning: Do not delete the existing path settings. Deleting the settings may affect the
functioning of the system or other programs.
Note: The PATH can be a series of directories separated by semi-colons (;). Microsoft Windows
looks for programs in the PATH directories in the order from left to right. You should have only
one bin directory specified for the Java SDK at a time (those following the first one are ignored).
If there is a path setting already specified, you can update it with the path given here.
The new path is now set for each time you open the Command Prompt.
You can verify the settings by completing the steps detailed in section
5.3.1, “Checking the paths for the Java compiler and preverifier tools”.
The SDK comes with several example MIDP applications that demonstrate various possible
applications that you can develop for the Series 80 Platform. Thus, a good way to familiarize
yourself with how to use the SDK is to build and run an example application. This will not only
guide you through the basic steps of building an application, but will also introduce you to the
emulator and its functionality.
In this section we will go through the main tasks involved in creating a MIDP application (that is,
a MIDlet) with the SDK. These steps will then be covered in more detail in the following sections.
1 Note: The task sequence in this section presumes that you have already installed the SDK
and that the prerequisites for installation and use outlined in section 5.2, “What you will need”
and 5.3, “Checking the Application Development Environment” above have been met. It is also
recommended that you have a Series 80 Platform target device to which you can upload the
application created in this section. For more detailed information on installation and related
requirements, please refer to the Series 80 Developer Platform 2.0 SDK for Symbian OS – For
MIDP Installation Guide [1].
In section 6.2, “Building the Hello World MIDlet” you will compile a simple interactive Hello
World MIDlet. Although this application is very basic in that it displays only a simple string on the
phone screen, it can be easily adapted to make more complex applications.
Before running the MIDlet in the emulator or installing the MIDlet to your phone you will first
need to package it for installation. This involves creating a manifest file, application JAR File and
application JAD file.
After packaging the MIDlet you can can run it in the emulator. With the emulator you can see
how the application would run on a real phone
After building an application and running it in the emulator, typically the next phase in
application development is testing and debugging before uploading it to your phone. This is
sometimes referred to as the ‘edit/compile/build cycle’.
2 Note: The application development described in this guide is done using a simple editor
and command prompt. More advanced development environments that you can use include, for
example, Borland JBuilder. Notice that before starting to use these in connection with SDK, you
will need to configure them so that you can run the Series 80 emulator (included with the SDK)
with them. For instructions on how to use the above mentioned development environment,
please refer to the Help documentation provided with the tool in question. For instructions on
how to build and run example applications, see the Example Applications section in the SDK Help.
7.6
4 mkdir C:\tmpclasses
6 cd C:\Nokia\Devices\S80_DP2_0_MIDP_SDK\Series80ex\src
7 3. Compile the Hello World MIDlet by entering the following command in the Command
Prompt:
8 javac -d C:\tmpclasses –classpath
C:\Nokia\Devices\S80_DP2_0_MIDP_SDK\lib\*.zip;C:\Nokia\Devices\S80_DP2_0_MIDP_SDK\Seri
es80ex\src com\nokia\examples\lcdui\helloworld\HelloWorldMIDlet.java
The HelloWorld MIDlet has now been compiled to the tmpclasses directory. Next, you will need
to preverify the classes that have been created.
To allow more efficient memory usage on the target device, checking the code for correctness is
done offline by using the preverifier tool. The preverifier checks that the classes are correct and
inserts additional information into the class files. The Virtual Machine looks for this information
and uses it for a much simpler verification based on the data collected by the preverifier. The
preveifier ensures that the MIDlet does not violate the MID’s security policies.
To preverify the HelloWorld MIDlet that you have compiled, do the following:
9 4. In the Windows Command Prompt, use the mkdir command to create a directory into
which the preverifier tool should output the classes created in compiling the MIDlet. Enter the
following command:
10 mkdir C:\classes
11 5. Use the cd command to switch to the \bin subdirectory of the directory where you
installed the SDK. Enter, for example, the following command:
12 cd C:\Nokia\Devices\S80_DP2_0_MIDP_SDK\bin
13 6. Preverify the Hello World MIDlet classes by entering the following command:
Before running the compiled and preverified HelloWorld MIDlet, you need to package the
MIDlet.
7.8 Packaging the Hello World MIDlet
As distributed, a MIDlet consists of a Java archive (JAR) file and a Java Application Descriptor
(JAD) file. The JAR file contains a manifest, a special file that contains metainformation about the
files in the JAR file.
A manifest is a text file located in the JAR file. The manifest describes information about the
MIDlets in the JAR file.
16 cd C:\classes
17 2. Create the MANIFEST.MF file by entering, for example, the following command:
18 edit MANIFEST.MF
19 3. The manifest file opens in the editor. Enter the following information into the manifest
file that you are creating:
20 4. Select File > Save to save the edited MF file.
21 5. Select File > Exit to close the editor.
Here is a simple example of using the JAR.EXE utility to build a JAR file:
26 1. In the Windows Command Prompt, change to the classes subdirectory where the
preverified class files are located and where you created the MANIFEST.MF file. Enter, for
example, the following command:
27 cd C:\classes
28 2. Create a JAR file named HelloWorldMIDlet.jar which includes the manifest file, the
MIDlet classes and the resource files. Enter, for example, the following command:
The JAR tool creates the file HelloWorldMIDlet.jar to the classes subdirectory.
31 edit HelloWorldMIDlet.jad
32 Note: Make sure that you use the extension .jad in the file.
2. The file opens in the editor. Enter the following information into the JAD file that you are creating:
3. Select File > Save to save the edited JAD file.
4. Select File > Exit to close the editor.
33 Make sure that at least all mandatory attributes and their values in the JAD file are typed
correctly and that they are in the right format. The attributes and values of the JAR package’s
manifest file must be correct as well. The best way to ensure that is to use a packaging tool, for
example, Nokia Developer’s Suite for J2ME™. With this tool it is easy to set and update attibutes
and values into both the JAD and manifest file.
38 Now that you have created the package MIDlet, you can run and view it in the emulator.
40 cd C:\Nokia\Devices\S80_DP2_0_MIDP_SDK\bin
41 2. Run the Hello World MIDlet in the emulator by entering the following command in the Command Prompt:
42 emulator -Xdescriptor:C:\classes\HelloWorldMIDlet.jad
The emulator appears on the screen and displays the Hello World string:
In this section you have compiled and preverified the Hello World MIDlet, and also seen what the
Hello World MIDLet would look like in a real phone. The next step would be to install it to a
target device. The installation procedure is covered in the next section.
The file transfer can be done through various channels depending on your PC, for example using
Bluetooth, Infrared or USB cable. The steps below provide two examples on how to install a
MIDlet to your Nokia 9500 Communicator.
43 Note: You must have built-in IrDa hardware and Infrared and Wireless Link installed on
your computer. If you do not have built-in IrDA, see your computer manual for more details on
how to install an Infrared and Wireless Link.
44 1. Make sure that the infrared ports of the sending and receiving devices are pointing at
each other.
45 2. Activate the infrared port on the Nokia 9500 Communicator and wait until the infrared
icon on the Windows status bar appears (until the infrared connection between the PC and
phone has been activated).
46 3. Open the Windows Explorer on your PC and browse to the directory where the
application file is located.
47 4. Select the .jad and .jar files.
48 5. Click the right mouse button on top of the selected file and select Send to > Infrared
Recipient. The application files are sent to your device via Infrared. Your phone should receive
the installation files as a message attachment.
49 6. Go to the messaging folder in your device and open the transferred installation file. If
requested, confirm the installation command and follow the wizard to complete the installation
process. A notification is displayed when the installation is complete.
50 Note: This deployment method requires that the Nokia PC Suite 6.4 is installed on your
computer. Previous versions of PC Suite may also be used but they require additional installation
of the Nokia PC Connectivity Cable Drivers. More information can be found from
http://www.nokia.com/pcsuite.
51 1. Make sure that your phone is configured for PC Suite connection: Tools > Control Panel
> Connections > Cable setup > Data cable mode should be changed to PC Suite Connection.
52 2. Connect your Nokia 9500 Communicator to the PC either with Nokia Connectivity Cable
DKU-2 or via infrared port.
53 3. Right-click on Nokia PC Suite icon from system tray and select Nokia Application
Installer.
54 4. The Nokia 9500 device should appear in the My Phone list. If the device is not present,
click the Select a phone button, choose the Nokia 9500 device and click OK. In the case the phone
is not shown in Phone Selector window, check the connection.
55 5. In the My Computer list, browse to the folder where you have stored installation file.
Select the file and click the Install button.
56 6. Finish the installation by following the Application Installer wizard.
7.15 Using the SDK with Nokia Developer's Suite 2.2 for J2ME™
Series 80 Developer Platform 2.0 SDK for Symbian OS – For MIDP is installed and configured
automatically when Nokia Developer’s Suite for J2ME™ is installed. You can also add and remove
the SDK manually:
57 1. Start the IDE where the Nokia Developer’s Suite is integrated or start Nokia Developer’s
Suite for J2ME™ as stand-alone.
58 2. Select Tools > Nokia Developer’s Suite for J2ME > Configure Emulators… from the IDE
menu. In the stand-alone version, select Emulators > Configure Emulators… The Configure
Emulators dialog opens.
59
Figure 6: Configure Emulators dialog
60 3. The emulator should be visible in the Emulators list. If it is not visible, choose Add… and
select the directory you installed the SDK. The default MIDP SDK home path is
C:\Nokia\Devices\S80_DP2_0_MIDP_SDK. Push Open to accept.
61 4. The properties of the selected emulator device are displayed in the tool. As the SDK
contains only one device, it is selected automatically as the default emulator device.
62 Note: Note that a emulator may contain one or more devices. If there is more than one
device you can configure each one individually. Change currently selected device from the Select
default device combo box. This combo box is not displayed for Series 80 MIDP SDK, the emulator
contains just one device.
63 5. Select the emulator and choose Set as default. The emulator is now set as default MIDP
SDK for this project.
69 Note that this only removes the emulator from Nokia Developer's Suite 2.2 for J2ME™ tool
set. The actual uninstallation of the emulator must be done with the Series 80 Developer
Platform 2.0 SDK for Symbian OS – For MIDP's own uninstallation procedure. If the SDK/emulator
has not been uninstalled it can be reloaded to Nokia Developer's Suite 2.2 for J2ME™ with Add...
button.
7.17
7.18 Development
Start Emulators tool allows you run a MIDlet directly from the local file system.
The stand-alone installation of Nokia Developer's Suite 2.2 for J2ME™ does not include tools for
editing, compiling or debugging the MIDlet classes, you must use third party tools and a Java™
SDK for these purposes. The other option is to install Nokia Developer's Suite 2.2 for J2ME™
integrated with an IDE such as Borland ® JBuilder™, Sun™ ONE Studio or Eclipse platform, which
provide the tools for editing, compiling and debugging MIDlets .
When you have successfully installed and configured the Series 80 MIDP SDK, you can start
developing MIDlets and running them on the SDK:
70 1. Create or open a MIDlet project as defined in Nokia Developer’s Suite for J2ME™ User’s
Guide [4]
71 2. To start the emulator, in IDE select Tools > Nokia Developer’s Suite for J2ME > Start
Emulators… In stand-alone version press Start Emulators on the panel.
72 3. Browse the application to be started.
73 4. Select the emulator from the Emulators list.
74 5. Click the Emulate button to start the application. Emulators execute the MIDP
Application file described in the text field when you press Emulate. If running with class, a
warning will appear if any of the selected devices do not support that feature. All devices are
executed in their own processes so they do not share the same instance of the application.
75 To run the MIDlet Suite examples.jad included with the Series 80 MIDP SDK, browse to
directory C:\Nokia\Devices\S80_DP2_0_MIDP_SDK\Series80ex\bin, select the example.jad and
press Emulate.
Figure 7: Running Series 80 examples.jad from Nokia Developer's Suite
Select the MIDlet to run and press Enter. The MIDlet launches on the Series 80 MIDP SDK
Emulator.
Before you can specify the SDK to be used in your JBuilder project, you have to add it to the set
of available Java Development Kits (JDKs). Follow the instructions in the JBuilder help menu
under MobileSet Guide to configure the emulator as a JDK to be used in application
development. The JDK directory to select is the root directory of this SDK.
78 2. To add the SDK to the list, click New… The New JDK Wizard opens.
79
Figure 10: New JDK Wizard
80 3. In the Existing JDK home path: field, browse to the SDK installation directory and select
it. The Series 80 MIDP SDK is displayed in the Name for this JDK field.
81 4. Click the drop-down arrow and select a storage location for the JDK specifications library
file. The available locations varies by JBuilder editions, see JBuilder Help for details.
82
Figure 11: Series 80 MIDP SDK in JDK Wizard
83 5. Click OK.
84 6. In the Configure JDKs dialog, select SDK from the tree view.
85
Figure 12: Configure JDK
86 7. From the JDK Settings, select the Micro tab. S80_DP2_0_MIDP_SDK should now be
shown as the Target Device.
87
88 8. Click OK.
7.21
7.22
7.23
7.24 Development
The Series 80 Developer Platform 2.0 SDK for Symbian OS – For MIDP can be used to develop and
run MIDlets. The SDK is able to run applications packaged into a MIDlet Suite, as specified in the
MIDP specification, or directly from a MIDlet class. When you are running a MIDlet suite, both a
JAD file (Java Application Descriptor) and a JAR file need to be created before the application can
be run. For general instructions on creating MIDlet Suites, see the MobileSet Guide in JBuilder.
Users of JBuilder Personal Edition need to use the Nokia Developer’s Suite for J2ME(TM) to
create the JAD and JAR files.
For more infomation on how to develop, build and run applications using JBuilder, see the User’s
Guide and the Example Applications section in the SDK Help and the Jbuilder documentation.
You can add optional Emulator parameters for the Runtime Configuration by selecting Project >
Project Properties... Select the Run tab and select Edit…
If you are using the Professional or Enterprise Edition of Borland JBuilder and the Achive builder
(JAR tool) that comes with them, the JAR file is automatically updated in the build process.
With JBuilder Personal Edition and Nokia Developer’s Suite for J2ME(TM), it is important to
‘Recreate’ the JAD and JAR files before running the application. Otherwise the emulator will run
the old version of these files instead of using the newly compiled classes.
Once the MIDlet class and/or MIDlet suite has been created, they can be run by using the
MicroRun feature. Select a MIDlet class or the JAD from the project pane and then select Run >
MicroRun.
When you have installed and configured the SDK properly you can start using the debugging
features in Borland JBuilder. To start debugging, select the MIDlet class or the JAD file from the
project pane and select Run | Micro Debug. If you have defined breakpoints in the content pane,
code execution will stop when a breakpoint is reached.
Instead of Borland JBuilder’s internal debugger you can also use third-party debuggers, or you
can use the JBuilder debugger as an external debugger when executing MIDlets outside of
Borland JBuilder (that is from the Wireless Toolkit or the command-line).
To use Borland JBuilder’s debugger as an external debugger for an SDK launched from outside
the JBuilder, see Chapter 14.3 “Debugging from the command-line”
In order to use Borland JBuilder as an external debugger for the SDK, you must select the
following options:
103 1. Enable remote debugging by checking the appropriate check box.
104 2. Select Attach.
105 3. Check that the Transport Type value is “dt_socket.”
106 4. Set the port in the Address field of the Debug tab to match with the debugger port
defined in the SDK’s start-up command.
107 5. Start the emulator with -Xdebug and -Xrunjdwp parameters as described in Chapter 14.3
“Debugging from the command-line”
108 6. Start the debugger by choosing Run > Micro Debug from the JBuilder menu.
111 2. To add the SDK to the list, click New… The New JDK Wizard opens.
112
Figure 16: New JDK Wizard in JBuilderX
113 3. In the Existing JDK home path: field, browse to the SDK installation directory and select
it. The Series 80 MIDP SDK is displayed in the Name for this JDK field.
114 4. Click the drop-down arrow and select a storage location for the JDK specifications library
file. The available locations varies by JBuilderX editions, see JBuilderX Help for details.
115
Figure 17: Series 80 MIDP SDK set as new JDK
119 7. From the JDK Settings, select the Micro tab. The should now be shown as the Target
Device. Click OK.
120
Figure 19: Micro tab in JDK configuration
For more infomation on how to develop, build and run applications using JBuilderX, see the
User’s Guide and the Example Applications section in the SDK Help and the JbuilderX
documentation.
You can add optional Emulator parameters for the Runtime Configuration by selecting Project >
Project Properties... Select the Run tab and select Edit…
If you are using the Professional or Enterprise Edition of Borland JBuilderX and the Achive builder
(JAR tool) that comes with them, the JAR file is automatically updated in the build process.
With JBuilderX Personal Edition and Nokia Developer’s Suite for J2ME(TM), it is important to
‘Recreate’ the JAD and JAR files before running the application. Otherwise the emulator will run
the old version of these files instead of using the newly compiled classes.
Once the MIDlet class and/or MIDlet suite has been created, they can be run by using the
MicroRun feature. Select a MIDlet class or the JAD from the project pane and then select Run >
MicroRun.
7.29
7.30
To start debugging, select the MIDlet class or the JAD file from the project pane and select Run |
Micro Debug. If you have defined breakpoints in the content pane, code execution will stop when
a breakpoint is reached.
Instead of Borland JbuilderX´s internal debugger you can also use third-party debuggers, or you
can use the JBuilderX debugger as an external debugger when executing MIDlets outside of
Borland JBuilderX (that is from the Wireless Toolkit or the command-line).
138
Figure 21:JBuilderX’s debug properties for the runtime configuration
To use Borland JBuilderX’s debugger as an external debugger for an SDK launched from outside
the JBuilderX, see Chapter 14.3 “Debugging from the command-line”
In order to use Borland JBuilderX as an external debugger for the SDK, you must select the
following options:
139 1. Enable remote debugging by checking the appropriate check box.
140 2. Select Attach.
141 3. Check that the Transport Type value is “dt_socket.”
142 4. Set the port in the Address field of the Debug tab to match with the debugger port
defined in the SDK’s start-up command.
143 5. Start the emulator with -Xdebug and -Xrunjdwp parameters as described in Chapter 14.3
“Debugging from the command-line”
144 6. Start the debugger by choosing Run > Micro Debug from the JBuilderX menu.
7.32 Using the SDK with Sun J2ME™ Wireless Toolkit 2.1
To check that the Sun J2ME™ Wireless Toolkit has recognized the SDK as a target device:
Open KToolbar from the installed Wireless Toolkit menu.The SDK should be displayed in the
Device drop-down list.
Figure 22: Series 80 MIDP SDK configured in Wireless Toolkit
If the Series 80 MIDP SDK is not displayed on the list, carry out the following steps:
145 1. Install, or copy an already installed, Series 80 MIDP SDK to the
<WTK_home>\wtklib\devices folder. For example, C:\WTK21\wtklib\devices
146 2. Open Ktoolbar.
147 3. When the Series 80 MIDP SDK is installed to the correct location, it will be displayed in
the Device list and can be started. If the SDK has been installed somewhere else, you must copy
the entire emulator directory to the device directory.
148 Having now configured the emulator, you are ready to start with application development.
For further instructions, see Example Applications in the SDK Help.
Development
J2ME Wireless Toolkit has the following bugs/features that affect the building and running
procedures of the application:
149 • The build process uses the class library of the previously selected device before the Run
button is pressed. After you have attempted to run the application, the build process will start
using the correct library until the selected device is changed again.
150 • The build process does not automatically refresh the MIDlet JAR package after building
the application. Choose Project > Package > Create Package from the menu to refresh the JAR
package before running the application.
The clean database utility of J2ME Wireless Toolkit has no effect on this emulator. The only way
to clean up the RMS database of the emulator is to manually delete the application-generated
content of the “appdb” directory.
157
Figure 23: Wireless Toolkit’s Remote debugging port dialog
158 3. Enter the Remote debugging port in the text field (e.g. 5000) and click the Debug button
to put the SDK in debug wait state.
159 4. Launch an external debugger to connect the SDK to the debug port: jdb -connect
com.sun.jdi.SocketAttach:hostname=localhost,port=5000
160 The debugger is connected to the SDK’s debug port when you see the text “Connection
received” in the SDK’s prompt. Type help in the debugger prompt to see the available debugger
commands. The run command starts MIDlet execution.
7.35
7.36
7.37
7.38
7.39
7.40 Using the SDK with Sun Java Studio Mobility 6 2004Q3
The emulator integrates into Sun Java Studio Mobility 6 2004Q3 either via J2ME Wireless Toolkit
(WTK) or via UEI.
To integrate via WTK, you must have the J2ME WTK and Sun Java Studio installed, and the
emulator must be installed into directory <WTK home directory>\wtklib\devices.
167 For more information see chapter Emulator Installation from document “Technical
Articles: Introduction to Sun Java Studio Mobility 6” [5].
You can assign the SDK as your default emulator by selecting the SDK with the right mouse
button and choosing Set as default from the pop-up menu.
7.42
7.43
7.44 Development
Complete the following tasks before attempting to run the application:
168 1. In the Sun Java Studio´s File menu, select Mount Filesystem…
169 2. Select Local Directory from the New Wizard dialog and click Next.
170
Figure 24: New Wizard dialog
171
172
173
174
175
176
177 3. Select src folder of selected example and click Finish.
178
Figure 25: New Wizard – Local Directory
179 4. Build the project by pressing “F11” or by selecting Project > Build Project from the
menu.
180 5. Start the application by pressing “F6” or by selecting Build > Execute from the menu.
181 See the document 'Technical Articles: Introduction to Sun Java Studio Mobility 6 [5] for
instructions on how to use Sun Java Studio 6 Mobility to develop MIDlets.
7.45
7.46
7.47
7.48
7.49
7.50
183
Figure 26: Create new MIDlet Suite
184
185
186
187 2. Add new object name to the next dialog.
188 3. From Add MIDlet dialog select Use Existing MIDlet and click browse.
189
190
191
192
193
194
195
196
197
198
199 4. Select MIDlet for this example and click OK.
200
Figure 28: Choose MIDlet class dialog
201 5. Click Next and enter MIDlet´s name and icon and click Finish.
202 6. In the Sun Java Studio’s Explorer window, select the MIDlet suite or source code to
execute and to assign a breakpoint, click the right mouse button on source code line and choose
Toggle breakpoint from the popup menu..
203 7. Choose Debug > Start Session > Run in Debugger or press Alt+F5.
204 The Sun Java Studio will switch to the Debugging workspace and launch the SDK to Debug
process. The execution will stop when a breakpoint is reached.
205 Note: Use only one mounted file system for the MIDlet suite when debugging your MIDlet.
Series 80 MIDP SDK supports only one source folder at a time. Files added to any other folders
are not recognized.
7.52
7.53 Using the SDK with IBM® WebSphere® Studio Device Developer
206 Note: Debugging on Series 80 MIDP SDK emulator is not supported with IBM ® WebSphere®
Studio Device Developer.
7.55 Starting the IBM® WebSphere® Studio Device Developer for the first time
The first time you start the WSDD after you installed the Series 80 MIDP SDK, you are informed of
a new “Series 80 Developer Platform 2.0 SDK for Symbian OS, For J2ME MIDP” plug-in.
Figure 29: Configuration changes pending
Click Finish. You are asked to restart WSDD to take the plug-in into use.
207 Note: If the WSDD does not inform you about the new plug-in and you have installed
Series 80 MIDP SDK to other directory than the default C:\Nokia\Devices\S80_DP2_0_MIDP_SDK,
you need to edit the correct SDK path to file C:\Program
Files\IBM\DeviceDeveloper\eclipse\links\ com.ibm.ive.S80_DP2_0_MIDP_SDK.link
209
Figure 31: Create and manage device configurations
210 2. Select UEI Emulator Device from the list and click New.
211
Figure 32: New UEI Emulator Device
212 3. In the Device Configurations dialog, edit the Device name field. To complete the
Emulator root directory field, click Browse to search the file system, then select the installed
Series 80 MIDP SDK main directory (C:\Nokia\Devices\S80_DP2_0_MIDP_SDK)
213
Figure 33: Configured Series 80 MIDP SDK device
214 4. Click OK.
7.57 Development
One or more MIDlets can be packaged into a MIDlet suite. Do the following to create a MIDlet
suite:
215 1. Start WSDD and select File > New Project
216
Figure 34: New project in WSDD
217
218
219
220
221
222 2. Select J2ME and MIDlet Suite.
223
Figure 35: J2ME MIDlet suite selected
224
225
226
227
228 3. Click Next.
229
Figure 36: MIDlet Suite Creation
230 4. Enter the name of the suite to be created. Select the MIDP version. In the appropriate
field, enter the name of the MIDlet, the name of the package, and name of the MIDlet class. Click
Finish.
232
Figure 37: Import dialog
233
234 2. Select File System and click Next.
235
Figure 38: Import from file system
236 3. Click the Browse button to select the directories from which you would like to add the
files.
237 4. Select the Series 80 example directory
C:\Nokia\Devices\S80_DP2_0_MIDP_SDK\Series80Ex and press OK.
238
Figure 39: Importing Series 80 examples
239 5. Select the files you want to add. Expand the hierarchies in the left pane and select or
clear the checkboxes that represent the folders in the selected directory. Then in the right pane,
select or clear checkboxes for individual files. When you have finished specifying your import
options, click Finish.
241
Figure 40: Run configurations
242
243
244
245
246
247 2. In the Run configurations dialog, select MIDlet suite from the list and click New.
248
Figure 41: New MIDlet Suite configuration
249 3. In the Run dialog, edit the run configuration fields. To complete the Project field, click
Browse to set the project. Set the configured “Series 80 MIDP SDK Emulator” to the Device or
JRE field.
250
Figure 42: Series 80 MIDP SDK set as a device
251 4. Select the MIDlet suite examples.jad to be run using the combo box. Click Run. The
following MIDlet selector dialog is shown:
252
Figure 43: MIDlet selector
253 5. Select the MIDlet to run and press Enter. The J9 VM and the MIDlet launches on the
Series 80 MIDP SDK Emulator.
254
Figure 44: MIDlet running on Series 80 SKD emulator
The emulator allows you to view and test MIDlets on your PC before installing them on a real
device. It provides a graphical interface of a real Nokia 9500 Communicator and device
functionality to test your MIDlet.
255 Note: If your MIDlet does not respond to commands, you can kill your MIDlet using the key
combination Shift + Ctrl + Alt + K, which kills the application with the current keyboard focus.
256 You can reuse a previously created run configuration to run your MIDlet suite:
257 1. Click Run > Run.
258 2. In the Run dialog box, select a run configuration from the Configurations list.
259 3. Click Run.
Nokia Developer’s Suite for J2ME™ Version 2.2 for Windows integrates automatically with Eclipse
3.0 if you choose the correct install set when Nokia Developer’s Suite is istalled.
Select the root directory of the Eclipse IDE in the file system and continue the installation of
Nokia Developer’s Suite for J2ME™ Version 2.2 for Windows.
/features
/com.nokia.phone.tools.midp.ide.eclipse_1.0.0
/com.nokia.phone.tools.sdk.plugin.eclipse_1.0.0
/plugins
/com.nokia.phone.tools.designer_1.0.0
/com.nokia.phone.tools.midp.ide.eclipse_1.0.0
/com.nokia.phone.tools.sdk.plugin.eclipse_1.0.0
7.62 Setting Java Debug Preferences
When debugging MIDlets on Series 80 MIDP SDK emulator device, it is necessary to turn off some
debugger preferences. To do so:
260 1. Select from the Eclipse menu Window > Preferences.
261 2. Then select Java > Debug from the preferences tree.
262 3. Clear Suspend execution on uncaught exceptions, Suspend execution on compilation
errors and Suspend for breakpoints during evaluation.
263 4. Increase timeout values to prevent debugger timing out before the debugged MIDlet
has started. We recommended that you increase the debugger timeout to 50,000 when
debugging with Series 80 MIDP SDK.
264
Figure 47: Java Debug settings for Eclipse 3.0
7.63 Development
In this chapter we go through the tasks needed to create a MIDP application with the Series 80
Developer Platform 2.0 SDK for Symbian OS – For MIDP using the example application delivered
with the SDK.
To be able to create a new project for Series 80 Developer Platform SDK, carry out the following
steps:
265 1. Select File >New >Project in the Java Perspective.
266
Figure 48: New project in Eclipse
267
268
269
270
271
272 2. Select Java > MIDP Project (Nokia SDK Plug-in) and click Next
273
Figure 49: new MIDP project
274 3. Enter the name for the project. If you choose a directory for the Project content, make
sure the project name is the same as the name of the content directory. Click Next to continue.
275
Figure 50: SDK selection wizard in Eclipse
276 4. Select the SDK you wish to use for compiling and preverifying the MIDP project. If the
SDK is not displayed in the drop-down list, click Browse… and select the root directory of the SDK.
Click Next to continue.
277
Figure 51: MIDP settings in Eclipse
278 5. Make sure that the project source folder in build path and default output folders are set
correctly. Click Finish.
279 Note: Use only one source folder for your MIDlet if you are using Nokia Developer’s Suite
for J2ME™ Version 2.2 for Windows for creating packages in Eclipse. Nokia Developer’s Suite for
J2ME™ Version 2.2 for Windows supports only one source folder at a time. Files added to any
other folders are not recognized.
7.65
283
284
285
286
287 3. Select File System and click Next.
288
Figure 53: Import src from the file system
289 4. Import src directory and browse the Into folder setting and click Finish.
7.67
7.68
7.69
When you wish to run the source of a MIDlet class in the Series 80 MIDP SDK Emulator, select the
class in one of the following ways:
290 • Select the class’ .java file in the Package Explorer
291 • Select the .jad file in the Package Explorer
292 • Select the project that includes the MIDlet in the Package Explorer
293 • Open the MIDlet in the editor
294 Then choose Run > Run As > Nokia SDK. This will create a launch configuration for the
MIDlet. The Series 80 MIDP SDK Emulator starts up.
You can edit the launch configuration. Choose Run > Run… The dialog for creating, managing, and
running configurations opens. Select a launch configuration under Nokia SDK Plug-in in the
configurations list.
Debugging a MIDlet
When you want to debug an existing MIDlet with the Series 80 MIDP SDK, select a configuration
you want to debug in one of the following ways:
295 • Select the class’ .java file in the Package Explorer
296 • Select the .jad file in the Package Explorer
297 • Select the project that includes the MIDlet in the Package Explorer
298 • Open the MIDlet in the editor
299 Add breakpoints to the MIDlet. Select to debug the configuration, for example from Run >
Debug as > Nokia SDK. The Debug perspective opens in the Eclipse.
To modify configuration settings, choose Run > Debug… The dialog for creating, managing, and
running configurations open.
Using the SDK from the command-line
The emulator can also be used from the command-line. As an alternative to standard command-
line syntax you can also use Unified Emulator Interface (UEI) syntax.
Manifest-Version: 1.0
MicroEdition-Configuration: CLDC-1.0
MIDlet-Name: HelloWorldMIDlet
MIDlet-Vendor: MyCompany
MIDlet-1: HelloWorldMIDlet, , com.nokia.examples.lcdui.helloworld.HelloWorldMIDlet
MIDlet-Version: 1.0
MicroEdition-Profile: MIDP-2.0
MIDlet-Version: 1.0
MIDlet-Vendor: MyCompany
MIDlet-Jar-URL: HelloWorldMIDlet.jar
MicroEdition-Configuration: CLDC-1.0
MIDlet-1:HelloWorldMIDlet,
,com.nokia.examples.lcdui.helloworld.HelloWorldMIDletMicroEdition-Profile: MIDP-2.0
MIDlet-Jar-Size: 1276
MIDlet-Name: HelloWorldMIDlet
Option Description
- help Shows emulator help.
- version Shows emulator version.
- http_proxy Specifies the HTTP proxy to be used for networking.
<host>:<port>
- debugger Runs the application with debugging enabled.
- dgb_port <port> Specifies the TCP/IP port to be used between the debugger and
the debug proxy. By default, the emulator assigns the first
unnallocated port starting from 2810.
- port <port> Specifies the TCP/IP port to be used between the VM and the
debug proxy. By default, the emulator assigns the first
unallocated port starting from 2810.
- classpath <path> Specifies the directories and JAR files to be searched for classes.
You may include both library and application class directories
and JAR packages.
- Xdescriptor <file> Specifies the name of the JAD file to be used for finding the JAR
| -jad <file> file to execute. This name must always be specified. The
following rules will be used for searching for the JAR file:
(1) If the JAD contains the entry for MIDlet-Jar-URL, and
(1.1) If the URL is a relative file URL, look for the JAR file using
the location of the JAD file as reference.
(1.2) If the URL is an absolute file URL, look for the JAR file using
the absolute path.
(2) If the JAD file does not contain the entry for the MIDlet-Jar-
URL, search from the classpath.
The KVM debug proxy that is required for source level debugging will be started automatically
when the emulator is started in debug mode from the command-line.
cd C:\Nokia\Devices\S80_DP2_0_MIDP_SDK\bin
1 2. Type the following command to run examples included with the SDK:
To debug the execution of an application launched from the command-line, you need an external
debugger. You can use the Java Debugger included in the Java Development Kit by Sun
Microsystems. Alternatively, you can use Borland JBuilder’s debugger as the external debugger.
See Chapter 8.3, “Debugging with Borland JBuilder” for further information on how to use the
JBuilder debugger.
Basic steps for debugging:
1 1. Start the SDK in debugging mode. The easiest way to do this is to use emulator.exe in
the bin directory of the MIDP SDK:
This puts the SDK debugger connection in wait state. The SDK waits for the debugger connection
to port 4452.
1 2. Launch the debugger to connect with the SDK:
The debugger is connected to the SDK’s debugger port when you see the text “Connection
received” in the SDK’s prompt.
1 3. Start debugging:
4 The run command starts MIDlet execution. Type help in the debugger prompt to see the
available debugger commands.
9 Camera
You can use the getSnapshot method in javax.microedition.media.control.VideoControl to get a
snapshot. The SDK uses the files located in the camera directory in the SDK’s installation
directory for camera emulation. You can change the files presented in the figure below to suit
your needs but remember to maintain the aspect size and format of the images.
Figure 55: Viewfinder and snapshot images in supported capture formats
Audio Recording
You can record live audio with the Series 80 Developer Platform 2.0 SDK for Symbian OS – For
MIDP using a microphone and Mobile Media API. You should test that your microphone is
working properly before using the SDK for audio recording purposes. If you do not have a
microphone you can set Stereo Mixing or Line in as your audio source. In Windows the recording
options are available in the Recording Control dialog box.
The Series 80 MIDP SDK installation package includes the Nokia Connectivity Framework (NCF)
Lite version. You can use NCF to communicate with other Nokia Terminal SDKs and Nokia
products that support NCF connectivity.
NCF manages, configures and integrates products so that they can communicate with each other.
NCF provides an integration platform for delivering content data in mobile development
environment between the connected external software components, for example phone
emulators, content development tools, software development tools and server emulators.
NCF Lite is installed with the Series 80 MIDP SDK installation by default and it provides
communication environment with Bluetooth, SMS and MMS technologies. NCF Lite can emulate
Bluetooth hardware; you can use Bluetooth messaging in the Series 80 MIDP SDK Emulator
without having Bluetooth hardware installed.
NCF Full version provides support for hardware components, such as Nokia D211 and Bluetooth
cards. It contains a full communication environment with features like run-time communication
monitoring and visualization of environments. You can download NCF Full version from the
Forum Nokia website.
10 Getting started
NCF starts automatically when you log onto a Windows workstation. When NCF is started, the
Nokia Connectivity Framework -icon appears on the system tray.
Figure 56:Nokia Connectivity Framework icon on the system tray
You can start NCF manually by selecting Windows Start > Programs > Nokia Developer Tools >
Nokia Connectivity Framework > Nokia Connectivity Framework Lite
To shut down NCF service, click the icon on the system tray and select Shutdown.
1 Note: The startup link for NCF is located in Windows Start > Programs > Startup menu. You
can remove this automatic start-up by deleting the program shortcut.
NCF uses phone numbers, which can be used to send messages between started emulators. To
check the phone numbers of started products, click the NCF service icon on the system tray. A
pop-up menu shows the product names and phone numbers.
2 Note: Wait a couple of seconds before checking the phone numbers because the phone
number initialization takes a while.
2
Figure 57: Series 80 MIDP SDK’s phone numbers in Nokia Connectivity Framework pop-up menu
Each pop-up menu item shows phone numbers for technologies that the product supports. Use
this phone number when sending messages. For example, use number 55512351, shown in the
figure, to send MMS messages to the Series 80 MIDP SDK emulator. You can send a MMS
message as you would in real phone.
You can edit, reply to, or forward received messages with the emulator. When you select Send,
the emulator saves the sent message in the
C:\Nokia\Devices\S80_DP2_0_MIDP_SDK\bin\epoc32\Wins\c\msgout directory and sends it via
NCF.
The Series 80 MIDP SDK accurately simulates the receipt of a message, as the user of a Nokia
9500 Communicator device would experience it.
Figure 59: Receiving a MMS message
Each product configures NCF communication automatically when the product is installed. You
should not need to make additional configurations unless you change the product installation
manually.
To add new products to work with NCF you just have to install NCF compatible products on your
computer. Products need to be installed in their default location or the home directory has to be
configured from the product properties in the NCF product integration files.
It is strongly recommended that the NCF configuration should be made using the configuration
features in NCF FULL version.
If you want to configure product properties, it is done by modifying product integration xml-files
from the product’s NCF integrations directory. By default, you’ll find the Series 80 MIDP SDK
integration files in the directory:
C:\Nokia\Tools\Nokia_Connectivity_Framework\integrations\Series_80_DP_2.0_SDK_for_Symbi
an_OS_For_MIDP
For example:
1 • To change the Series 80 MIDP SDK product home directory (that sets value for the
environment variable _PRODUCT_HOME) modify
Series_80_DP_2.0_SDK_for_Symbian_OS_For_MIDP.xml
2 • To change the SMS Inbox, make your changes to
Series_80_DP_2.0_SDK_for_Symbian_OS_For_MIDPSMSFileHandler.xml
3 • MMS Outbox in modified in
Series_80_DP_2.0_SDK_for_Symbian_OS_For_MIDPMMSFileHandlerServer.xml
4 • To change VCOM port settings (* used with Bluetooth communication, modify
Series_80_DP_2.0_SDK_for_Symbian_OS_For_MIDPVCOMServer.xml
You need to restart the NCF after the configurations in order to take the new settings into use.
5 Note: (* To enable Bluetooth when you use NCF, you need to set the COM port in
C:\Nokia\Devices\S80_DP2_0_MIDP_SDK\bin\epoc32\wins\c\System\Data\bt.esk to be same as
VCOM setting in Series_80_DP_2.0_SDK_for_Symbian_OS_For_MIDPVCOMServer.xml file.
12 Documents included with Series 80 Developer Platform SDK
The Series 80 Developer Platform SDK Help provides information and instructions needed when
working with the Software Development Kit to create new Nokia 9500 Communicator
applications with C++.
Besides general documents such as this User’s Guide, the Series 80 Developer Platform
SDKcontains a wide range of documentation:
6 • Symbian OS Developer Library, the guide and reference for Symbian OS with Series 80
API documentation containing:
7 o API Guides - purpose and description for each API
8 o API Reference
9 o Guides for Nokia Tools and Utilities
13 Forum Nokia
Forum Nokia is the Nokia support forum for developers using its technologies and is found at
http://www.forum.nokia.com/
14 Java
As the Java technology was created by Sun technologies Inc., a good place to find comprehensive
introductions to Java is the java.sun.com (http://java.sun.com /) website, and its wireless pages
(http://developers.sun.com/techtopics/mobility/ ) in particular.
WMA The Wireless Messaging Api (WMA) is an optional package for J2ME
that provides platform-independent access to wireless
communication resources like Short Message Services (SMS).
WTK The Java 2 Platform, Micro Edition (J2ME) Wireless Toolkit is a
development enviroment for developing Java applets and
applications.
Before Writing MIDlet Application
http://www.forum.nokia.com/Technology_Topics/Development_Platforms/Java.xhtml
To find out which platform, edition, and feature pack your device uses, consult the Forum Nokia
Device Specifications pages and check the ‘Developer Platform’ section of the technical
specifications.
Once you’ve determined which platform your device uses, you can download the SDK for the
relevant feature pack and SDK.
Download the latest S60 platform SDKs that support Java™ development »
Download the Series 40 platform Java SDKs »
If you’re new to Java development, you’ll also need a Java™ Development Kit (JDK) — either JDK
6 or JDK 5.0.
Download a JDK »
I can build an application on a PC, but how do I get it onto a phone?
Although you develop Java™ applications on a PC, the goal is to run them on a Nokia device. Two
simple steps will help you do this.
If you’ve chosen to develop with NetBeans Mobility, you now have the option
to use the NetBeans deployment module to transfer your application to a
device connected to your PC directly from NetBeans. (Open your project’s properties and look
for the Deploying option.) If you’re using another IDE, you can deploy your applications using the
Install Applications option in PC Suite.
Adnan Fakhar
velocitykhan@yahoo.com