【问题标题】:Send coordinates to the device将坐标发送到设备
【发布时间】:2012-11-29 20:33:23
【问题描述】:

我正在学习 android,但遇到了问题。

我在使用 de emulator 时遇到了一些问题,所以我在真实设备上运行我的应用程序。但我有一个问题,因为我必须模拟我接近某个点。 例如,我在 x-10,y-10,当我在 x,y 时,我必须显示信息。

我知道如何通过 telnet 发送位置并且我知道 DDMS 工具,但是我可以使用 DDMS 工具在真实设备中模拟吗?如何?

我读过:

使用 DDMS 工具,您可以通过几种不同的方式模拟位置数据:

  • 手动将单个经度/纬度坐标发送到设备。
  • 使用 GPX 文件描述播放到设备的路径。
  • 使用描述各个地点标记的 KML 文件以按顺序播放到设备。

但我看到定位控件已禁用。

提前感谢

【问题讨论】:

    标签: android android-emulator


    【解决方案1】:

    您可以使用 Fake gps 等应用。

    https://play.google.com/store/apps/details?id=com.lexa.fakegps&hl=en

    下载并安装此 apk。您可以设置任何位置。

    要检查您是否到达您的位置,说 (x, y):

    检查 (x, y) 与您当前的 GPS 定位之间的距离。如果这两个位置之间的距离(以米为单位)为 0(实际上给出至少 10 的缓冲区),那么你就达到了你的命运!

    Location currentLocation = your current location fetched from GPS.
    Location destinationLocation = your destination location co ordinates
    
    if (currentLocation.distanceTo(destinationLocation) <= 10) {
      // Reached destiny
    }
    

    【讨论】:

    • 谢谢,非常有用。那么,是不是可以通过 DDMS 工具跟踪路线来模拟到达某个点的方法?我必须实施 onLocationChanged 才能知道用户何时在该点附近 n 米。有没有办法模拟这个?再次感谢
    • 您是否要查找两个位置之间的距离(以米为单位)?
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2011-11-09
    • 2019-03-08
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多