Aaargh - more J2ME stupidity

Tags: rants, java, j2me,

Added: 2010-07-04T00:00

Aaargh - more J2ME stupidity

I've always wondered why my location tracker was consistently saying that my location was updated a while ago.

For the record, I send the lat, the lon, and the timestamp in a little packet to my server, which stores it in a DB, and the location page uses AJAX to keep obtaining the latest value, and centre the Google Map with the value thereof. I also display the current server time minus the timestamp received from the device - my thinking being that it should only ever be a few seconds out. NTP is accurate, and so is GPS.

However, I've just today found out that javax.microedition.location.Location.getTimestamp() provides the timestamp of when the GPS signal was received by the device, rather than, as I had expected, the timestamp of the GPS signal.

This is annoying. This means that if my device (phone) time is wrong, all my updates are wrong.

And it seems that there's no way to get the timestamp of the GPS signal other than delving into getExtraInfo("application/X-jsr179-location-nmea"), and parsing the raw NMEA. Which is ridiculous.
The more I use of J2ME, the more crazy things like this I find, and the sooner handsets run standard Java, the happier I'll be.

Update: I've written a little couple of functions to do this which I'll test out later - you can find them at http://code.calum.org/J2ME/NMEAUtils.java

Add a comment

Your IP:
Please enter 3891944 here: