我想在Android模拟器中获得经度和纬度进行测试。
有谁能指导我如何实现这个目标吗?
如何将模拟器的位置设置为测试位置?
我想在Android模拟器中获得经度和纬度进行测试。
有谁能指导我如何实现这个目标吗?
如何将模拟器的位置设置为测试位置?
当前回答
Android Studio有一个名为“Mock Location plugin”的插件。 你可以用这个插件模拟多个点。 你可以在这个链接中找到详细的使用手册:Android Studio。用模拟位置插件模拟多个GPS点
其他回答
如果您正在使用Eclipse,请转到窗口->打开透视图->DDMS,然后在位置控制中键入1并单击发送。
打开Android studio->工具菜单->Android-> Android设备监视器->模拟器选项卡->位置控制->设置所需的纬度和经度,并根据需要检查项目
对于Android Studio用户:
运行模拟器,
然后进入“工具->Android ->Android设备监视器”
打开模拟器控件选项卡,并使用位置控件组。
The already mentioned multiple times answer to use the shell command "geo fix..." is the correct answer. But in case you use LocationClient.getLastLocation() to retrieve your data it is worth to mention that it will not work at first. The LocationClient class uses the Google Play Service to retrieve the coordinates. For me this started working after running the emulators maps app once. During the first start you are asked to allow google apps access to your location, which I guess does the trick.
在Mac、Linux或Cygwin系统下:
echo 'geo fix -99.133333 19.43333 2202' | nc localhost 5554
这样你就能到墨西哥城了。相应地改变你的经度/纬度/高度。如果你对nmea不感兴趣,这应该足够了。