Wednesday, September 21, 2011

Use Mock GPS Location for Android Development - Part One

Recently, I am working on an Android google map app that requires some fake GPS position input. Here are several easy ways for you to quickly input mock GPS locations for your Android development:

Using Emulator:
1. Using geo fix 
cd to your .\android-sdk\tools\ folder, and then telnet to your avd. e.g.
$ telnet localhost 5554
$ geo fix -118 35
$ exit
The help geo fix shows that it takes these parameters 'geo fix log lat '...

2. Using DDMS
In your emulator control view, using the Location Controls to send the location, e.g.

Using Android Device:

Use mock location generation tool like Location Spooler: https://market.android.com/details?id=org.ajeje.fakelocation&feature=related_apps

1) Start location spooling


2) Start the app


Note:
1. Remember to save in the android manifest xml the mock location permission;
2. Enable the mock GPS location access on your droid phone. 

Also refer to here:
http://stackoverflow.com/questions/2531317/android-mock-location-on-device


2 comments:

(Coding && Eating) || Sleeping