Technorati Tags: ,

As new mobile devices are released with built in GPS we see that the implementation of the GPS Intermediate Driver can very from one to another.

A key area is the format for the latitude and longitude that GetGpsPosition returns.  On previous devices this has always been returned in raw NMEA format, but on HTC devices they return decimal degrees (formats ref: http://home.online.no/~sigurdhu/Deg_formats.htm)

HTC say that "This is the API recommended by Microsoft" which is fair enough, but I think perhaps the documentation needs to be stronger to make this explicit. (ref: GPSGetPosition: http://msdn2.microsoft.com/en-us/library/ms893621.aspx, GPS_POSITION:  http://msdn2.microsoft.com/en-us/library/ms893674.aspx ).  Hopefully other manufacturers will follow HTC's route because it is probably simpler to return decimal degrees

Currently though we have to add conditional logic to detect the device manufacturer and then calculate location differently for HTC devices to other devices.  Which brings me to the next point - how to detect a device manufacturer?  You can read the GetOemInfo string from SystemParametersInfo (coredll.dll) but that returns the model name and not the manufacturer.  The way recommended by HTC to detect their devices is to check if the following registry is there:
[HKEY_LOCAL_MACHINE\SOFTWARE\HTC].  This seems a bit fragile to me (what happens if someone installs some HTC software on a non HTC device?), but appears to be the best we have at the moment,

HTH

Ian