Developing the isync4j for MIDP application with the Sun Wireless Toolkit

This topic describes how to develop the DB2 Everyplace ISYNC4J for MIDP within the Sun Wireless Toolkit application. The examples used in this section are based on the VNurse sample application.

Prerequisites

See Overview of DB2 Everyplace synchronization providers for detailed information on hardware and software prerequisites for using the DB2 Everyplace J2ME MIDP synchronization provider.

Procedure

  1. Launch the Wireless Toolkit. From a command line prompt, change to the bin directory where the Sun Wireless Toolkit is installed. Type ktoolbar.bat.
    Note:
    It is recomended to use a command prompt instead of the Windows Start menu.
  2. Create a new project for the isync4j sample application:
    1. Open the J2ME Wireless Toolkit
    2. Select New Project.
    3. Type the project name (for example, VNurse)
    4. Type a MIDlet class name (for example, com.ibm.mobileservices.demo.VNurse)
    5. Click Create Project.
    6. Copy the ISyncMidp.jar file to the J2ME project library. For example:
      c:\>copy %DSYINSTDIR%\Clients\Midp\lib\ISyncMidp.jar \ 
        j2me_install_dir\apps\VNurse\lib.
      
    7. Optional: If you want to view the trace output while the MIDlet is running, copy ISyncMidpDebug.jar to the j2me_install_dir \apps \VNurse \lib.
      ΑΦ:
      Do not use trace when building a JAR file that will be installed on the phone.The resultant JAR file will be too large to install.
    8. Optional: To use obfuscation (to reduce the code size), copy the retroguard.jar file to the bin directory where J2ME is installed.
    9. Click Settings . The Settings for project window opens. Click the User Defined tab and click Add to type the following Key and Value entries:
      • Db2eSyncPassword, nurse1 [default]
      • Db2eSyncUserName, nurse1 [default]
      • PacketDownSize, 2800 [ default 30000 ]
      • PacketUpSize, 1400 [ default 30000]
      • Db2eSyncHost, localhost [default]
      • Db2eSyncPort, 9080 [default]
      These values are placed in the .jad file by the Sun Wireless Toolkit and the MIDlet reads their values at run time.
    10. The DB2 Everyplace sample application (VNurse) will display a PNG image file. Click the MIDlets tab and select MIDlet-1. Click Edit and change VNurse.png to ibm.png. You will need to copy ibm.png from the Midp\samples\images directory to the J2ME_ install_ dir\apps\VNurse\res directory.
  3. Import the DB2 Everyplace sample Java files into the project. For example, copy the directory structure from %DSYINSTDIR%\Clients \Midp \samples \com to the J2ME_ install_ dir \apps \VNurse \src directory.
  4. Build and run the VNurse sample application. From the Sun Wireless Toolkit window, click Build and click Run.

Related tasks

Related concepts