views:

709

answers:

2

Hy everyone, I have two questions

1) I have not been able to find out in which units Location.distanceBetween receivs the latitude and longitude. Is it degrees or microdegrees? Whats the unit for the distance returned? Sorry for this noob questions but I have not been able to find anything on the documentation.

2) In windows XP using Eclipse 3.3.2. Emulator does not send coordinates properly. Either it by hand or by loading a gpx file the locationListener is not invoked. This same code I have tried it in Ubuntu and works fine. Does someone know how can I solve this? In the office there is no linux installed and I can take my personal laptop.

Thanks a lot in advanced!

A: 

1) From android source:

public static void distanceBetween(double startLatitude, double startLongitude,
    double endLatitude, double endLongitude, float[] results) {
    if (results == null || results.length < 1) {
        throw new IllegalArgumentException("results is null or has length < 1");
    }
    computeDistanceAndBearing(startLatitude, startLongitude,
        endLatitude, endLongitude, results);
}

And inside computeDistanceAndBearing there is comment that says:

// Based on http://www.ngs.noaa.gov/PUBS_LIB/inverse.pdf
// using the "Inverse Formula" (section 4)

I would check there

2) Go to:

  • Settings
  • Applications
  • Development
  • Check if "Allow mock locations" is on.
Macarse
Thanks for you comment. Unfortunately they have not helped me.I check the pdf you send but it is a lot of math stuff I dont understand. I just want to know in which units I am supposed to pass parameters (degrees? microdegrees?) and in which unit the results will be shown (meters, kilometers).As regards 2) "Allow mock locations" is on.Thanks anyway, does somebody have any idea on this topic?
Santiago
A: 

I had problems with the emulator not getting locations from ddms and it turned out to be because I had an non-english locale which appears to screw it up. You can try adding "-Duser.language=en" to the start parameters for java in the ddms start script and see if it helps. The bug is here

Oh and I don't know the input units for lat/long but the resulting float is in metres according to the api docs.

alun