Skip to content

(Android) test GPS on emulator

Andrzej M edited this page Mar 9, 2014 · 3 revisions

To test functionality when using the Google Play Services (like location service or Google Maps) you must use emulator that runs the Google APIs platform based on Android 4.2.2 or higher. (However, when u run tests on real devices you need Android 2.3 or higher and includes Google Play Store).

Emulator from ADT

Connect to emulator via telnet

In order to change GPS coordinates you need to connect to your emulator via telnet.

  1. Lunch proper emulator.
  2. Check it's number (it's on the top of emulator, usually somewhere around 5554. You can also check it in adb with command adb devices)
  3. Open command line and type:
telnet localhost <device_number>

for example: telnet localhost 5554.

If everything goes well, you should see on the screen similar information:

Android Console: type 'help' for a list of commands
OK

If system can't find telnet, it's probably turn off in system configuration. (to fix this issue on Windows, go to Control Panel. Under Programs and Features, click on Turn Windows Features on or off and turn on Telnet client).

Alternatively, you can download PuTTYtel, small telnet client (from here ), a bit more comfortable to use. To connect via PuTTy, type localhost in 'Host name' field and <device_number> in 'Port' field.

Change gps position

After connection, changing coordinates is simple, just type :

geo fix <longitude value> <latitude value>

It's good to know that telnet often get lost, when Backspace and Delete is used. If you mistyped something, just hit Enter, and do it again.

Genymotion emulator

Genymotion has built-in GPS widget and it's really fast, even on average CPU. Just press Ctrl+2, and easy-to-use GUI will be open.

Remember, that you need to install Google Play Store on your emulator, since Genymotion do not provide it by default.

Getting stated with Genymotion

First you have to download emulator form producer site: http://www.genymotion.com/. (in order to do so, you need do make your own account). There is ready-to-run version available (already with VirtualBox), so it shouldn't be a problem witch configuration.

Then you need to lunch an emulator. I hope it won't be a problem. (Open Genymotion, add some device- all file needed will be downloaded automatically, and press play).

Adding Google Play Store to your emulator

Complete solution how to do it can be found in this guide. It's step-by-step instruction, so not much is left to add:

  • you can restart your emulator using adb -> just type adb reboot
  • in my case API 17 does not work, I mange to run everything properly on API 18 (using Galaxy Nexus 4.3 720x 1280)