我想在Android模拟器中获得经度和纬度进行测试。

有谁能指导我如何实现这个目标吗?

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


当前回答

我在Android studio 3.5.1上也遇到了同样的问题 当我点击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.

Dalvik Debug Monitor >选择模拟器>模拟器控制选项卡>位置控制。

DDMS——android_sdk/tools/ DDMS或android_sdk/tools/monitor

最后,随着Android Studio 4的最新版本和2019年10月23日他的新模拟器更新,这变得更容易了。 启动模拟器,进入模拟器参数…>在“路线”选项卡,你可以选择地图上的两个点,从/到,开始一个新的路线,播放速度可调,可以达到1000公里/小时以上!

我试图通过adb为许多点设置地理定位,但无法让我的应用程序看到任何GPS数据。但当我尝试打开DDMS时,选择我的应用程序的进程并通过模拟器控制选项卡发送坐标,它马上就工作了。

请参见获取用户位置

请参阅提供模拟位置数据。你会找到解决方法的。