How can I mock my location on a physical device (Nexus One)? I know you can do this with the emulator in the Emulator Control panel, but this doesn't work for a physical device.
If you use this phone only in development lab, there is a chance you can solder away GPS chip and feed serial port directly with NMEA sequences from other device.
For desktop computers you can create/install drivers that emulate a GPS device/serial port device for the purpose of doing this kind of testing. Perhaps you could create or find something similar for android.
I found this example with some Googling - it sends data directly to the LocationManager.
Andrews link points in the right direction it seems the only way to do is to use a mock location provider. You have to enable mock locations in the development panel in your settings and add
<uses-permission android:name="android.permission.ACCESS_MOCK_LOCATION" />
to your manifest. Now you can go in your code and create your own mock location provider and set the location of this provider like explained in Andrews link
You can use the Location Services permission to mock location...
"android.permission.ACCESS_MOCK_LOCATION"
and then in your java code,
// Set location by setting the latitude, longitude and may be the altitude...
String[] MockLoc = str.split(",");
Location location = new Location(mocLocationProvider);
Double lat = Double.valueOf(MockLoc[0]);
location.setLatitude(lat);
Double longi = Double.valueOf(MockLoc[1]);
location.setLongitude(longi);
Double alti = Double.valueOf(MockLoc[2]);
location.setAltitude(alti);
I wish I had my cable handy. I know you can telnet to the emulator to change it's location
$ telnet localhost 5554
Android Console: type 'help' for a list of commands
OK
geo fix -82.411629 28.054553
OK
I cannot remember if you can telnet to your device, but I think you can. I hope this helps.
You'll need adb (android debugging bridge) for this (CLI).