我想在Android模拟器中获得经度和纬度进行测试。
有谁能指导我如何实现这个目标吗?
如何将模拟器的位置设置为测试位置?
我想在Android模拟器中获得经度和纬度进行测试。
有谁能指导我如何实现这个目标吗?
如何将模拟器的位置设置为测试位置?
当前回答
Android Studio有一个名为“Mock Location plugin”的插件。 你可以用这个插件模拟多个点。 你可以在这个链接中找到详细的使用手册:Android Studio。用模拟位置插件模拟多个GPS点
其他回答
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.
如果你使用Android Studio (1.3):
点击菜单“工具” “Android” “Android设备监视器” 单击当前模拟器 选项卡“模拟器控制” 进入“位置控制”,输入纬度和高度
你可以使用像genymotion这样的模拟器,它可以让你灵活地模拟当前的GPS位置等。
Dalvik Debug Monitor >选择模拟器>模拟器控制选项卡>位置控制。
DDMS——android_sdk/tools/ DDMS或android_sdk/tools/monitor
对于新的模拟器:
http://developer.android.com/tools/devices/emulator.html#extended
基本上,点击模拟器控件中的三个点按钮(模拟器的右侧),它将打开一个菜单,允许你控制模拟器,包括位置