Nonetheless the last year has seen a revival of location based chatter on the web and i don't seem to be able to escape from it. Last year we field tested location based java micro edition software on regular phones and bluetooth gps receivers. Then this year three seperate companies asked us help them with their location based software. All three were having difficulties with the technology so it's safe to say it's not as easy as some might portray.
First off, there is very little on the web in the way of working, open examples that you can take apart and examine. Countless sites have a code fragment that works for them, on their hardware. And then there were a bunch of authors who wrote about something they made in the Sun WTK emulator but never tested on a real phone. These 'look at me, my boss gave me time to read the tutorials and now i'm a guru' authors always annoy me because they always say things that are wildly wrong. For example at a local Java conference in the Netherlands there was someone lecturing on location based services who made the bold claim that 'Your mobile will determine which location based services are available and use them, so if you do not have a GPS receiver it will use the telecom networks positioning information. And yes you can actually use that right now!' not knowing that at the time there were no network operators that had that service switched on.
Anyway dragging myself back to the topic; part of the enthousiasm on the web has been due to the fact that a number of device manufacturers are starting to implement the location based API (JSR-179). It's been around for a while, but there used to be only two phones (guarded in finland by dragons) that had any sort of implementation. And needless to say they both had a different implementation all together. But Nokia and Sony Ericsson have been introducing enough models with a JSR-179 implementation to make it fairly widespread in the high-end segment of the phone market (in Europe anyway). This is a good development, but there are still a few problems with the Location API JSR-179 implementations:
- There are few phones that actually have an inbuilt method for location determination. The Nokia N95 must be the most popular, but most phones just do not have GPS hardware.
- The hardware that does have inbuilt GPS chips and antenna's tends to be exactly the hardware that is running an operating system that is hard to run java on. For example all the windows mobile devices that are popular for (among other things) in-car navigation. And what about all the Garmin, Becker and TomTom hardware that people are buying in busloads. Ever tried to run Java on one of those?
- A JSR-179 implementation dictates CLDC 1.1. So if you are developing for a number of devices here is another fragmentation issue. If you want your software to install on a CLDC 1.0 device (and there a tons of them) you cannot use JSR-179. So now you have two code-bases.
- The JSR-179 implementations are still new and therefore buggy. For example an implementation we tried automatically tried to search for GPS bluetooth devices the first time we tried it, but had no facility to change which GPS bluetooth device was selected. Great if you buy a new GPS receiver!
Generally speaking there are three strategies for getting location information in Java Micro Edition:
- Use the location API
- Use the bluetooth API (JSR-82) and bluetooth serial port protocol to read from a GPS bluetooth receiver.
- Use the serial port protocol to read from a COM port on the device.
Each strategy requires completely different code. I've tried em all, and they can all be done, but not on all hardware.
It's late... I'll get back to this soon.