android模拟器可以用gpx文件模拟海拔高度吗?
我正在尝试从 ddms 角度模拟模拟器设备的运动。我正在使用包含海拔元素的 gpx 文件,但是当我的代码运行时,它只检索纬度/经度并表示海拔 = 0。
我的问题是,Android 模拟器可以用于模拟海拔、速度等吗?或者只是用于纬度和经度数据?
I am trying to simulate motion of the emulator device in the ddms perspective. I am using a gpx file which contains elevation elements, but when my code runs, it only retrieves lat/lon and says that elevation = 0.
My question is, Can the android emulator be used to simulate altitude, speed etc, or is it just for latitude and longitude data?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
这并不是真正的答案,但它可能会给您一些有用的想法。
您使用什么类型的提供商?有 2 个选项:
LocationManager.GPS_PROVIDER
和LocationManager.NETWORK_PROVIDER
。我的猜测是,只有使用LocationManager.GPS_PROVIDER
时,海拔高度才可用。另外,在
Location
更新中(在LocationListener.onLocationChanged(Location location)
中),您可以调用location.hasAltitude()
。如果此修复包含高度信息,则返回 true,否则返回 false。更新:
看来您遇到了一些模拟器问题。我记得我使用的是 Eclipse 3.4.1 + ADT 0.9.5 + Android 2.0.1 应用程序 + WinXP,为模拟器提供 GPS 修复的唯一方法是使用 Telnet。所以我刚刚为此创建了一个辅助 Ruby 脚本:
您会看到我传递 0 作为海拔(“geo fix ...”的最后一个参数),但是您可以尝试使用非零值。如果您不熟悉 Ruby,那么您可能可以将该脚本采用您最喜欢的脚本语言。让我知道这是否对您有用。
This is not really an answer, however it may give you some useful ideas.
What type of provider do you use? There are 2 options:
LocationManager.GPS_PROVIDER
andLocationManager.NETWORK_PROVIDER
. My guess is that altitude can only be available ifLocationManager.GPS_PROVIDER
is used.Also on you
Location
updates (inLocationListener.onLocationChanged(Location location)
) you can calllocation.hasAltitude()
. It returns true if this fix contains altitude information, false otherwise.UPDATE:
So it looks like you are experiencing some emulator issue. I rerember I was on Eclipse 3.4.1 + ADT 0.9.5 + Android 2.0.1 app + WinXP and the only way to feed the emulator with GPS fixes was to use Telnet. So I just created a helper Ruby script for that:
You see I pass 0 as the altitude (the last param at 'geo fix ...'), however you may try with your non-zero values. If you are not familiar with Ruby, then you could probably adopt the script to your favorite scripting language. Let me know if this worked for you.