如何在 Android Emulator 中模拟 GPS 位置? [英] How to emulate GPS location in the Android Emulator?

查看:50
本文介绍了如何在 Android Emulator 中模拟 GPS 位置?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在 Android 模拟器中获取经度和纬度以进行测试.

I want to get longitude and latitude in Android emulator for testing.

谁能指导我如何实现这一目标?

Can any one guide me how to achieve this?

如何将模拟器的位置设置为测试位置?

How do I set the location of the emulator to a test position?

推荐答案

您可以通过 Telnet 连接到 Emulator.然后你就有了一个模拟器控制台,可以让你输入某些数据,比如地理定位、网络等.

You can connect to the Emulator via Telnet. You then have a Emulator console that lets you enter certain data like geo fixes, network etc.

此处详细解释了如何使用控制台.要连接到控制台,请打开命令行并键入

How to use the console is extensively explained here. To connect to the console open a command line and type

telnet localhost 5554

然后,您可以使用 geo 命令在设备上设置纬度、经度和海拔(如果需要),这些海拔是使用 gps 位置提供程序传递给所有程序的.有关进一步说明,请参阅上面的链接.

You then can use the geo command to set a latitude, longitude and if needed altitude on the device that is passed to all programs using the gps location provider. See the link above for further instructions.

在控制台中运行的具体命令是

The specific command to run in the console is

geo fix <longitude value> <latitude value>

我发现这个网站对于寻找真实的经纬度很有用:http://itouchmap.com/latlong.html

I found this site useful for finding a realistic lat/lng: http://itouchmap.com/latlong.html

如果您需要多个坐标,您也可以使用带有路线的 kml 文件,这在 文章.我目前找不到更好的来源.

If you need more then one coordinate you can use a kml file with a route as well it is a little bit described in this article. I can't find a better source at the moment.

这篇关于如何在 Android Emulator 中模拟 GPS 位置?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆