How to emulate GPS location in the Android Emulator?

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?


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

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>

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

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.


I was looking for a better way to set the emulator's GPS coordinates than using geo fix and manually determining the specific latitude and longitude coordinates.

Unable to find anything, I put together a little program that uses GWT and the Google Maps API to launch a browser-based map tool to set the GPS location in the emulator:

android-gps-emulator

Hopefully it can be of use to help others who will undoubtedly stumble across this difficulty/question as well.

Android的全球定位系统模拟器


如果您使用的是Eclipse ,请转到Window->Open Perspective->DDMS ,然后在Location Controls输入一个,然后点击Send

链接地址: http://www.djcxy.com/p/2634.html

上一篇: 你如何在Android模拟器中安装APK文件?

下一篇: 如何在Android模拟器中模拟GPS位置?