Complementary Mobility Transferring an application Midlet to a mobile device Table of Contents Introduction .............................................................................................................................................. 2 Application Transfer Methods .................................................................................................................. 2 Transferring files using a USB cable .......................................................................................................... 3 Transferring an application using Bluetooth ............................................................................................ 5 Transferring an application using Infrared ............................................................................................... 7 Transferring an application using a memory card .................................................................................... 8 3: Transferring an application Midlet to a mobile device Page: 1 Complementary Mobility Transferring an application Midlet to a mobile device Introduction The purpose of this document is to explain how to transfer a completed application Midlet to a mobile device. This article assumes you are using Windows XP as your host PC operating system. Articles in this series include: 1: Introduction to Mobile Application Development 2: Beginning application development with MIDP 3: Transferring an application Midlet to a mobile device 4: Building an interactive application Midlet with MIDP 5: Building a multimedia application with MIDP Application Transfer Methods For this example a host PC running Microsoft Windows XP and a mobile phone will be used. You should have previously tested and debugged your application in the emulator, packaged it up and have a completed .jar application. On certain devices just the .jar file is required but on other devices you may need to copy the .jad file too. The .jar file is similar to a .zip file and contains a collection of all the files required to run the application. Sometimes a .jar file can become very large so a .jad file contains a description of the file contained within the associated .jar file which becomes a much smaller file. However, a .jad file cannot be used without a .jar file. An example of the contents of a .jad file is MIDlet-1: myApp, myApp.png, myApp MIDlet-Jar-Size: 1387 MIDlet-Jar-URL: myApp.jar MIDlet-Name: myApp MIDlet-Vendor: Unknown MIDlet-Version: 1.0 MicroEdition-Configuration: CLDC-1.0 MicroEdition-Profile: MIDP-1.0 There are a number of ways of transferring a java Midlet .jar including downloading directly from a website, as an email attachment, and using ftp over a wireless network connection. However, some of the more common methods which are explained in this document include: Direct cable connection, e.g. USB or Serial Bluetooth Infrared Using a memory card, e.g. SD card 3: Transferring an application Midlet to a mobile device Page: 2 Complementary Mobility Transferring an application Midlet to a mobile device Transferring files using a USB cable One of the more common methods for transferring a .jar file to a mobile device is to use a data USB cable (or a serial cable), often provided free with a mobile device. It is often possible to use the software suite that comes with the mobile device to transfer an application so it may be worth checking your product documentation for your mobile device (as applications operate slightly differently between manufacturers). However, it can often be as simple as using direct file transfer. Connecting the USB cable that comes with the device to a USB port on the development computer may bring up a window similar to that shown in the diagram. Clicking “Open folder to view files” will bring up a folder list similar to that shown in the following diagram. The folders work in a similar way to folders on Windows, so folders can be double-clicked and folders can contain files and other folders. 3: Transferring an application Midlet to a mobile device Page: 3 Complementary Mobility Transferring an application Midlet to a mobile device Locate a suitable folder, in this instance we will use Other and copy and paste the completed .jar file. You can find the location of the .jar file by looking in the toolkit interface window following a successful build. In order to install and launch your application on the mobile device using a Sony Ericsson K800i you would go into the handset menu, then select My Files, locate the folder where the application was placed then highlight it and selecting Install. Select Save in Applications then Start Now. In summary Locate the .jar file and copy it Connect the mobile device Identify a suitable folder and paste the copied file Navigate the mobile device and install the application 3: Transferring an application Midlet to a mobile device Page: 4 Complementary Mobility Transferring an application Midlet to a mobile device Transferring an application using Bluetooth Bluetooth is a local area networking technology, designed for short distances. To transfer a packaged application using Bluetooth you need to enable Bluetooth on your host PC and ensure that your mobile device supports Bluetooth. To start you need to establish a connection between the two devices, on a Sony Ericsson k800i this can be achieved by going into the menu then selecting Settings. Navigate to the Connectivity section then select Bluetooth. Ensure Bluetooth is turned on and is visible to the host computer. On the host computer go into My Bluetooth Places and double-click Find Bluetooth Devices. Locate your mobile device and double-click on it. A list of available services will appear on the display, look for OBEX File Transfer and select it. 3: Transferring an application Midlet to a mobile device Page: 5 Complementary Mobility Transferring an application Midlet to a mobile device In the taskbar area of the host PC you may be told that a Bluetooth PIN Code is required, this is for security. Click on the popup message and enter a suitable PIN code that you can remember. Your mobile device should ask if you wish to add the host PC to ‘My devices’. Select Yes and enter the PIN code you set in the previous step. Then select yes to access your items on your mobile device. You can now navigate your mobile device folders to locate a suitable folder, in this instance we will use the Other folder under the Phone memory folder and copy and paste the completed .jar file. You can find the location of the .jar file by looking in the toolkit interface window. In summary Enable Bluetooth on the host PC and the mobile device Pair the mobile device to the host PC Select the File Transfer OBEX service on the host PC Locate the .jar file on the host PC and copy it Identify a suitable folder on the mobile device and paste the copied file Navigate the mobile device and install the application 3: Transferring an application Midlet to a mobile device Page: 6 Complementary Mobility Transferring an application Midlet to a mobile device Transferring an application using Infrared If you have an infrared facility on both your mobile device and host PC then you may be able to use infrared to transfer files. To enable infrared on a Sony Ericsson k800i go to the handset menu, then navigate to Settings, then Connectivity. Highlight the Infrared port option and Select it. Ensure that On is selected (or 10 minutes to automatically switch off infrared after 10 minutes). Ensure that Infrared is enabled on your host PC and ensure there is a direct line of sight between the two devices. When the host PC detects the mobile device using infrared you will see something similar to that shown below. Locate then select the application and click Send – you will need to allow the mobile device to accept the application. Once you have transferred the .jar file you may also need to transfer the .jad file. Once the application is transferred, you can select to run it from the mobile device. In summary 3: Transferring an application Midlet to a mobile device Page: 7 Complementary Mobility Transferring an application Midlet to a mobile device Enable Infrared on the host PC and the mobile device Ensure line of sight and close proximity of the two infrared points Click the infrared icon on the host PC Locate the .jar file on the host PC and select it then click Send Allow the mobile to accept the application Run the application from the mobile device Transferring an application using a memory card One of the quickest ways to transfer an application from the host PC to the mobile device is to use a memory card if your mobile device supports it. To transfer an application using a memory card simply remove the memory card from your mobile device, place it in a suitable card reader attached to your host PC. The host PC will bring up a window where you can select to open a window to view files. Copy and paste the application .jar (and .jad if necessary) to a suitable folder on the memory card. Remove the memory card from the host PC and re-install the memory card back into the mobile device. 3: Transferring an application Midlet to a mobile device Page: 8