This post will guide you through the steps of setting up fake GPS on the Google Android emulator
Set permissions in AndroidManifest.xml:
Find the correct local port for your Android emulator:
$ adb devices
List of devices attached
The port we are looking for is in this case 5554. Now connect via telnet:
$ telnet localhost 5554
Connected to localhost.
Escape character is '^]'.
Android Console: type 'help' for a list of commands
Set your preferred location manually: You set the location with the geo fix command:
geo fix $longitude $latitude
For example the city center of Barcelona:
geo fix 2.169919 41.387917
CAUTION: the format of the coordinates you get from Google Maps is ($latitude, $longitude) - but the way you enter the geo fix for Android has longitude and latitude switched around.
Make sure everything works properly:
Just launch the Google Maps application in your emulator. It should take you directly to the location you entered and display a blue blinking light.
Access Android's Location Service in your application:
- I noticed that sometimes the manully entered location dissolves. I haven't looked into that yet, but a workaround for now is to simply re-enter the location via the geo fix command again.
- You always mix up latitude and longitude?
- Latitude: goes from East<>West, like the rungs of a ladder (→ sounds similar to latitude)
- Longitude: runs from North<>South. Think of the globe as a big, fat guy with a long (→ longitude) tie hanging down from the North Pole.
I've just launched a new side project of mine:
Bugfender - A modern remote logger tailor-made for mobile development
It's currently free and you can sign up here: https://app.bugfender.com/signup
Any kind of feedback is more than appreciated :-)