Backing up a Nokia 6300 mobile phone, for Linux users

Back to my home page

Contents

Introduction

A little while ago I got a Nokia 6300 mobile phone. I use the address book (aka contacts list), calendar and TODO lists quite a bit, and I'm a firm believer in backups (I like belt, braces, and a bit of spare rope as well), so I was looking for a way to back up all the data to my Linux PC over the USB cable.

After trying several alternatives, I ended up writing a small Java program that runs on the phone, and backs up all the data to a file on the memory card. I can then copy the file to the computer over the USB cable. While it's been written with the Nokia 6300 in mind, it may well work for other phones that support at least MIDP 2.0 and JSR 75.

This program is freely available under the GNU LGPL - you're welcome to use it if you think it might be useful. See LICENCE.txt in the source zip.

Other Ways of Backup Up

There are a number of ways that I could have backed the data up - some I tried, others I didn't. These include:

Use Gnokii or Wammu

The first things I tried were Wammu and Gnokii, both of which are easily available (e.g. can be installed using Yum in Fedora). In both cases, I had to configure them to use the AT command interface to the phone, on the port /dev/ttyACM0.

Both Wammu and Gnokii (actually xgnokii) worked, but they were limited by the AT command set that Nokia makes available. In particular, they couldn't export anything but the name and primary phone number of each contact, and they couldn't get at the calendar and TODO list at all.

Use Bluetooth and SyncML

I believe (but I'm not sure) that if I had Bluetooth on the computer I could sync the phone via SyncML, using programs like Evolution. USB Bluetooth adaptors are available, but I didn't want to buy one just to use once a month or so.

Use the Nokia Windoze application

I pretty much discarded this from the start. I'm not about to regress to installing Windoze just to back up the phone. Another alternative would be to try to get the Nokia suite working under Wine, but a couple of posts I found indicated that this might be non-trivial. And of course it hurts to have to go back to The Dark Side, even via Wine :) .

Features

In a nutshell, the backup program works like this:

  • The Java program sits on the phone's memory card
  • When the program runs, it creates a single file in a Backup directory on the memory card, which contains all the contents of the Address Book (aka contacts list) in vCard format, and the Calendar and TODO lists (in vCalendar format). The filename includes the date of the backup
  • You can then copy the file back to the computer (by mounting the memory card over the USB cable).

It's also important to realise what the program is not supposed to do:

  • It's not intended for synchronisation with any other data store
  • This version doesn't provide any means to re-import data from a previous backup - NOTE: the new version on SourceForge (see below) also supports restoring from a backup, including to another phone.

NOTE: The backup program only ever modifies the backup file - all items in the phone are opened in read-only mode.

Installing the Program

IMPORTANT NOTE: This project is now on SourceForge, and the version there is later than this one. In particular, the SourceForge version supports restoring as well as backing up, and fixes some minor usability bugs.

  • Copy the program jar file to your memory card. I put mine in a top-level directory called Java

  • Select the application in the phone, by going Apps | Memory Card | Java, and selecting MobileBackup. Don't open it yet!

  • You now have to set security options so that the program can access the address book etc., and write to the

    memory card

    • Press the Options button, and select Application Access | Data Access.
    • Select Read User Data, and set this option to Ask Every Time
    • Select Add and Edit Data, and set this option to Ask Every Time
    • Use the Back button to return to the application list

NOTE: I don't have a trusted key for signing the program - that's why the best you can manage is Ask every time. If the program was signed, you'd be able to set the options not to ask, or to ask only the first time (which would be much nicer).

Performing a Backup

  • Select the application in the phone, by going Apps | Memory Card | Java, and selecting MobileBackup. Select the Open button to open the program

  • You'll see 3 options: Backup phone, Set backup file root and Set debug. If you're using a phone like the Nokia 6300, you can go straight to Backup phone. If not, see the Other Phones section below

  • You'll see a title of Backup Phone, and an instruction to press Start to backup the phone. Go ahead and press Start

  • You'll now be prompted a number of times to confirm access for the following. You need to say Yes to each:

    • Edit and add new data in Memory Card (normally only once, but 3 times if the Backup directory doesn't exist)
    • Read data in Contacts (twice on my phone)
    • Read data in Calendar (5 times on my phone)
    • Read data in To-do list (once on my phone).
  • You'll now see a summary of the backup. This shows:

    • For each list exported, the type of list (Contacts, Calendar or TODO)
    • For each list exported within those list types, the list name (e.g. Phone, Memo, Reminder), followed by the number of items in the list
  • The backup file can be found in a file named Backup-yyyymmdd.txt in the Backup directory on the memory card, where yyyymmdd is the current date in year/month/day format.

  • You can now exit from the program, and copy the backup file to your computer (either the memory card via USB, or move the memory card if you're a glutton for punishment).

Other Phones

The program defaults to a backup file root of E:/, since this is the root for the memory card on a Nokia 6300.

If your phone is different, you should first choose the Set backup file root option. This gives you a list of all the file system roots on your phone, from which you should pick the one for your memory card. On the 6300, for example, the file system roots show as:

C:/
E:/

Selecting an item in the list confirms this as the new filesystem root, then returns you to the main screen. If you have set debug output on, this will also show the number of bytes used and available on this device - a useful way of finding out if you've chosen the correct one.

Potential Problems

If you see the message "Application access set to not allowed", it means that you haven't properly configured the security options in the installation step. Check everything from the 'Installing the Program' section above.

If you see any other error, you should first check whether you need to set a different file system root (see above under Other Phones). The next step is to select the Set debug option on the main screen. Now try the action again, and see if the extra output helps.

Backup File Format

The file format of the backup file is as follows (see example below):

  • Each list has a 3-line header, which includes the list type (Contacts, Calendar or TODO) and the list name (e.g. Phone, SIM, Meeting)
  • Each Contacts entry is in vCard format (version 3.0 if available, otherwise the first reported by the phone)
  • Each Calendar or TODO entry is in vCalendar 1.0 format
  • Each entry has a blank line after it.

Sample extract from the backup file:

# ========================================================================
# Contacts Phone
# ========================================================================
BEGIN:VCARD
VERSION:3.0
N:Adrian m
FN:
TEL;TYPE=PREF;TYPE=VOICE:0xxxxxxxxx
END:VCARD

BEGIN:VCARD
VERSION:3.0
N:Ajug Late Entry
FN:
TEL;TYPE=PREF;TYPE=VOICE:0xxxxxxxxx
END:VCARD

...

# ========================================================================
# Calendar Meeting
# ========================================================================
BEGIN:VCALENDAR
VERSION:1.0
BEGIN:VEVENT
DTSTART:20070625T210000
DTEND:20070625T220000
DALARM:20070625T200000
CATEGORIES:MEETING
SUMMARY;CHARSET=UTF-8:Some random meeting
LOCATION;CHARSET=UTF-8:Bell room
END:VEVENT
END:VCALENDAR

Building and Packaging

If you want to play with the code yourself, here's what you'll need to do:

  • Ensure that you have the following installed:

    • The Java Wireless Toolkit from Sun
    • Apache Ant (build tool)
    • Antenna, which is an ant extension for building WTK apps
  • Download and unzip the source distribution

  • In the ant build script (build.xml), set the paths to the WTK, Antenna, and to the directory on your memory card for deploying the jar (if you want to use the deploy target

  • Run ant -projecthelp to see the targets. These are currently:

    build    Compile classes, and create JAD file
    clean    Delete output directory
    deploy   Copy jar file to phone
    package  Package into Jar file
    run      Run the app inside the WTK emulator
    

Changes

  • Version 1.0, Released 29 July 2007

    First version