0
我正在使用android模拟器ddms来模拟使用gpx文件的移动。 gpx文件中有大约1000个条目。但是,我发现我的onLocationChanged方法在整个文件的过程中只触发了几次。我的代码如下...GPS模拟器轨迹
LocationManager locationManager = (LocationManager) this.getSystemService(Context.LOCATION_SERVICE);
locationManager.requestLocationUpdates(LocationManager.GPS_PROVIDER, 1000, 1, myListener);
myListener = new LocationListener(){
public void onLocationChanged(Location location){
double mylat = location.getLatitude();
double mylon = location.getLongitude();
...
}
...
}
我被设定为1000 requestLocationUpdates的理解是,它应要求每隔1秒提供的位置是大于1m从以前更加远离位置更新。它是否正确?如果是这样,为什么我只能从gpx文件中检索一些纬度/经度对?我不会检索近千个? (GPS数据来自某人运行,所以有不断运动。)
这实际上非常非常有帮助。当我将它设置为0,0时,我可以获得所有要点。所以......对于其他读者来说:按照Marc的建议。 – Ryan 2010-12-01 20:41:02