【问题标题】:Android: Location.distanceBetween units and emulator not sending coordinates properlyAndroid:Location.distanceBetween 单位和模拟器未正确发送坐标
【发布时间】:2010-02-24 08:25:26
【问题描述】:

大家好,我有两个问题

1) 我无法找出 Location.distanceBetween 以哪个单位接收纬度和经度。是学位还是微学位?返回距离的单位是什么? 很抱歉这个菜鸟问题,但我无法在文档中找到任何内容。

2) 在 Windows XP 中使用 Eclipse 3.3.2。模拟器无法正确发送坐标。无论是手动还是通过加载 gpx 文件,都不会调用 locationListener。我已经在 Ubuntu 中尝试过相同的代码并且工作正常。有人知道我该如何解决这个问题吗?在办公室里没有安装 linux,我可以带我的个人笔记本电脑。

非常感谢!

【问题讨论】:

    标签: android geolocation gps location emulation


    【解决方案1】:

    1) 来自安卓源:

    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);
    }
    

    在computeDistanceAndBearing里面有评论说:

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

    我会在那里检查

    2) 前往:

    • 设置
    • 应用程序
    • 发展
    • 检查“允许模拟位置”是否已打开。

    【讨论】:

    • 感谢您的评论。不幸的是,他们没有帮助我。我检查了您发送的 pdf,但其中有很多我不明白的数学内容。我只想知道我应该以哪些单位传递参数(度?微度?)以及结果将以哪个单位显示(米,公里)。至于 2)“允许模拟位置”已打开。无论如何,谢谢,有人对此主题有任何想法吗?
    【解决方案2】:

    我遇到了模拟器没有从 ddms 获取位置的问题,结果证明是因为我有一个非英语语言环境,这似乎把它搞砸了。您可以尝试在 ddms 启动脚本中将“-Duser.language=en”添加到 java 的启动参数中,看看是否有帮助。错误是here

    哦,我不知道 lat/long 的输入单位,但根据 api 文档,得到的浮点数以米为单位。

    【讨论】:

      猜你喜欢
      • 2019-12-24
      • 2011-10-26
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2019-04-29
      相关资源
      最近更新 更多