如何在 Eclipse Emulator for Android 中启用 GPS

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/10664202/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-19 18:12:02  来源:igfitidea点击:

How to enable GPS in Eclipse Emulator for Android

androideclipsegpsemulation

提问by user1404924

Possible Duplicate:
How to emulate GPS location in the Android Emulator?

可能的重复:
如何在 Android 模拟器中模拟 GPS 位置?

I'm struggling with activating the GPS functionality in the Android Emulator (Eclipse)

我正在努力在 Android Emulator (Eclipse) 中激活 GPS 功能

I wrote a test program for getting the current location. It's working on my Android Phone.. so I'm sure the app is working.

我写了一个测试程序来获取当前位置。它可以在我的 Android 手机上运行.. 所以我确定该应用程序正在运行。

If I'm testing the program in the Android Emulator from Eclipse... nothing is happening! What am I missing?

如果我在 Eclipse 的 Android Emulator 中测试程序......什么都没有发生!我错过了什么?

I already added GPS support in the AVD I know the Emulator control... but nothing is happening in the app.

我已经在 AVD 中添加了 GPS 支持我知道模拟器控件......但应用程序中没有发生任何事情。

Do I need to install some extra futures in the SDK?

我需要在 SDK 中安装一些额外的期货吗?

I hope someone can point me in the right direction!

我希望有人能指出我正确的方向!

回答by Alexandru Cristescu

With the emulator running, do a

在模拟器运行的情况下,做一个

telnet localhost 5554

to connect to the emulator. Then you can do several commands, for example:

连接到模拟器。然后你可以执行几个命令,例如:

geo fix (longitude) (latitude)

That command instructs the emulator to behave as if the phone was at those location (basically fake the GPS coordinates).

该命令指示模拟器的行为就像手机在这些位置一样(基本上是伪造 GPS 坐标)。

You can use google maps feature called "drop latlong marker" to get GPS coordinates for a particular place.

您可以使用名为“drop latlong marker”的谷歌地图功能来获取特定地点的 GPS 坐标。

回答by Mahesh

You just need to send latitude and longitude via Emulator Controlunder DDMS, no need to other things. pretty simple:)

您只需要在DDMS下通过Emulator Control发送纬度和经度,不需要其他东西。很简单:)

回答by android developer

the geo-fix solution works , but the eclipse ui solution should also work. you are not supposed to install anything special.

geo-fix 解决方案有效,但 eclipse ui 解决方案也应该有效。你不应该安装任何特殊的东西。

try to create a new emulator (which has gps support enabled in its features) and run it , select it in the emulators list under "devices" , and then go to the emulator control . set there the location and press "Send" .

尝试创建一个新的模拟器(在其功能中启用了 gps 支持)并运行它,在“设备”下的模拟器列表中选择它,然后转到模拟器控件。在那里设置位置并按“发送”。

in any case , if that doesn't work , you can even install third party apps on the emulator that do the same thing :

无论如何,如果这不起作用,您甚至可以在模拟器上安装执行相同操作的第三方应用程序:

https://play.google.com/store/search?q=location+spoofer&c=apps

https://play.google.com/store/search?q=location+spoofer&c=apps