Mock GPS routes in android emulator
How can I simulate movement of the emulator in a program that is tracking speed using the GPS? I understand that the general way to go about it is to go into the DDMS perspective, and then under emulator control upload a gpx file and press play to simulate that track. However, my code is not detecting the movement... and I am not sure if it is because of something wrong with my code or something wrong with the simulated emulator gpx. My code is simply
public void onLocationChanged(Location myLocal) {
float mySpeed=-1;
if(myLocal.hasSpeed()){
mySpeed = myLocal.getSpeed();
}
...
}
I have uploaded my gpx file and have pressed play, but no call to onLocationChanged occurs. If someone would be able to suggest a method to determine where the problem may lie it wou开发者_开发技巧ld be much appreciated.
Update 1 : I've found that the onLocationChanged method does get called when I use a real phone and not the emulator.
I had some issues with this some time ago. I'd recommend repeating the experiment using google maps or another equivalent app to isolate the issue to your code or to the emulator.
精彩评论