Programming the Nokia N95 phones

This outline will cover getting started with programming the Nokia N95 phones, as it relates to the SEng 462 project. While the phones can be programmed in other languages, this assumes that you plan to use Java and Netbeans. If you have any questions about the examples, you can contact the TA, Fiona Warman, at fwarman@uvic.ca.

Useful software
Netbeans 6 or 5.5.1 with the Mobility Pack (CLDC)
S60 Platform SDK 3rd edition, Feature Pack 1 emulator (optional, available here)
Note: some software which works on the phone appears not to work on the emulator, so be wary of the emulated results. Also, Feature Pack 2 can currently handle software which will not run on the phone.

Transferring files to the phone
With the MicroSD card in the phones, .jar files can be transferred to the card via USB under Linux and installed to either the phone memory or the SD card. You should only need to plug in the phone via USB, select "Mass Storage" as the connection option on the phone, and copy the files to the memory card. Then navigate to Tools -> File Mgr. -> Memory Card on the phone and select the .jar file to install it.

The Netbeans Mobility Pack
The Netbeans Mobility Pack allows you to create a Mobile application that will run on the phones. The N95 phones only support a limited feature set, as outlined on the device details page under "Java Technology". Specifically, note that they support MIDP 2.0 and CLDC 1.1 (not CDC) and that standard RMI is not currently available.

To create a new mobility project in Netbeans:
  1. Go to File -> New Project
  2. Select Mobile -> Mobile Application (MIDP Application in version 6) and click Next
  3. The defaults should work except for Step 3 (Default Platform Selection), where the Device Configuration should be CLDC-1.1, and the Device Profile should be MIDP-2.0. MIDP-2.1 will not work.
All example code, including index.html and login.php, is available in .tar.gz format here.

Example: Writing to files on the phone
FileWriting.jar is a simple example that writes to a file called test.txt on the MicroSD card in the phone. When the file is run, the only options are "OK" or "Exit", and if OK is selected it creates a file called test.txt on the memory card and writes the text "Grr argh" to that file.

The original .java file is available here. It was created using the above instructions for creating a Mobile Application on the phone, then dragging an "OK command" onto the phone template and filling in the appropriate behaviour for the OK command. Note that the standard file writing commands in Java are not all included on the phone - for example, BufferedOutputStreams are not currently supported.

The address for the phone memory card is: file:///Phone memory/
The address for the MicroSD card is: file:///Memory card/

Example: Connecting to a server over HTTP
HelloMidlet.java provides the user with a form where they can fill in a username. When the username is entered and the user chooses "OK", the username is sent to the server, where the server processes it in the form at index.html and returns the username that was entered using login.php. The username is then displayed as a Ticker on the phone. If the phone cannot connect to the server, an error is displayed as the Ticker instead.

Note: To run this code yourself, you will need to change the URL and port in HelloMidlet.java, and there needs to be a web server with index.html and login.php running successfully on it for the phone to connect to.

Useful links:
Nokia N95 Device Details
Quick Start Guide for a MIDP Application
Getting Started with the FileConnection APIs