The GPS C# sample in the WM5 SDK is extremely useful. You can get it here:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/mobilesdk5/html/mogrfgpssample.asp
However it has a small bug in one of the sample classes: if the longitude is a fraction of zero then a DivideByZeroException will be thrown. Of course this is only obvious if you live near Greenwich or somewhere else on the longitude zero line.
Anyway I'm worried about Latitude now - so I'm off to Nyeri in Kenya to try it out ;-)
What you want the fix? The example has a bug in the DegreesMinutesSeconds.cs class, ToDecimalDegrees() method
public double ToDecimalDegrees()
{
int absDegrees = Math.Abs(degrees);
double val = (double)absDegrees + ((double)minutes / 60.0) + ((double)seconds / 3600.0);
return val * (absDegrees / degrees);
}
If degrees are zero a DivideByZeroException will be thrown
Adding the following corrects it:
public double ToDecimalDegrees()
{
int absDegrees = Math.Abs(degrees);
double val = (double)absDegrees + ((double)minutes / 60.0) + ((double)seconds / 3600.0);
if (degrees == 0) { return val; };
return val * (absDegrees / degrees);
}
We were surprised to find recently that not all Windows Mobile 5 devices that have cameras, support CameraCaptureDialog. Calling ShowDialog() on an E-ten G500 just fails and the status api reports that no camera is present.
This is a real shame because as far as I was aware all WM5 devices with camera's should support this. The consistency of the CF across devices is one of it's biggest strengths and is a win for us compared to the intricacies of J2ME development.
The G500 is one of the first devices with a built-in GPS too so this was a double whammy , because that feature is a killer for our Mediaklik product.
However after a little bit of searching we found the Mio A701 - their tech support was extremely helpful - installing our test application which we emailed over, and even going outside to capture an image with gps location - worked like a dream.
So now we are repacing the batch of G500's with the A701, which perhaps could also be a lesson for the hardware manufacturers in the benefits of keeping your device compliant with the CF specs.
HTH
Ian