geocaching nokia app

Mobile application programming!



Last week I started off an adventure of trying to get cache information appearing on my mobile. This was because whenever I went out geocaching, I would print off a bunch of sheets of paper containing the cache information. I was burning through lots of paper :) So I figured what I needed to do was to get hold of a small text reader, chuck it on the phone, and bam, we’d be in business.

Of course, things are never that simple.

Next I tried out a bunch of applications from SourceForge, but nothing really did what I wanted it to do. Half of the apps didn’t work on my phone and the other half were a bit strange.

A while ago, a friend who has done a bit of mobile development (using Java) showed me the bare basics. Turns out you need to use a Java library named J2ME to get stuff working on your mobile. It’s just a cut down version of the standard API. So I downloaded the Java Wireless Toolkit which is apparently what you need - it includes the mobile phone emulator and a couple of other tools, and then ran through a great tutorial. Things are actually pretty simple. Sort of.

But just trying to get the damn thing working was a complete pain! First off I tried it with using JDK 1.6 (the latest version). It didn’t work. Then I tried JDK 1.4. That didn’t work. So the only option left was JDK 1.5, which was actually the ‘recommended’ one. Of course JDK1.5 didn’t actually want to install on my PC! The stupid thing just kept on hanging!! ARHGHGHGH!

So anyway, after stuffing around, trying to reinstall it a bunch of times and uninstalling other things I got it installed. Sort of. Either way, the Wireless toolkit stuff works and I can now write J2ME apps ok (I think)!

But just trying to get the damn thing working was a complete pain! First off I tried it with using JDK 1.6 (the latest version). It didn’t work. Then I tried JDK 1.4. That didn’t work. So the only option left was JDK 1.5, which was actually the ‘recommended’ one. Of course JDK1.5 didn’t actually want to install on my PC! The stupid thing just kept on hanging!! ARHGHGHGH!

So anyway, after stuffing around, trying to reinstall it a bunch of times and uninstalling other things I got it installed. Sort of. Either way, the Wireless toolkit stuff works and I can now write J2ME apps ok (I think).

nokia j2me app

So what does my program do?



Well, all I want the program to do is to be able to display a list of caches, and then to be able to select one, and then view its details. Writing this code was pretty straightforwarded.

The hard part was that I wanted to be able to store the cache details in a separate text file (“caches.txt”) so that I could periodically update this file whenever I go out caching. This was going to be tricky, because it meant that I needed to store the file on the SDCard of the phone, and then read the thing in at run-time.

This wasn’t as easy as you might think, because the standard API doesn’t actually have disk access! I guess that this is because when J2ME first started out, most mobiles didn’t actually have any form of filesystem. Fortunately they do now, and there’s a filesystem API available under the name “JSR 75” - which is a god thing because that makes it so easy to find (sarcasm off).

Then the other tricky part was working out how the Nokia phones then let you access their SDCard! Nokia fortunately have some really great reference documentation for programming their mobiles which was really helpful. Turns out they defined a system property which tells you the path for accessing the SDCard on their mobiles. Cool!

So as you can see in the attached screenshots, (or photo’s, I really should say), I got the damn thing working! I am the J2ME master!

geocaching nokia app

Now to see if anyone actually cares about the program :) I've posted a few messages on a few forum's, but most people don't seem to be too interested as yet :( Oh well!