我正在使用LocationListener
并且返回的位置始终具有方位为0.0
还有什么我需要做的吗?
我还注意到,在4.0.3更新时,我很少报告速度。现在我只是获得位置和准确性/提升
public void onLocationChanged(Location loc)
{
Log.d(LOG_TAG, "onLocationChanged");
Position position = new Position();
position.PositionGKey = UUID.randomUUID();
position.GPSTime = new Date(loc.getTime());
position.DeviceTime = new Date();
position.Latitude = loc.getLatitude();
position.Longitude = loc.getLongitude();
position.Altitude = loc.getAltitude();
position.Speed = loc.hasSpeed() ? loc.getSpeed() * 2.23693629 : 0;
position.Accuracy = (int)loc.getAccuracy();
position.Bearing = loc.hasBearing() ? loc.getBearing() : 0;
// There was cases with speed reported 1000+. Just make it real here, round of obvious errors.
if (position.Speed > 120)
{
position.Speed = 0.0;
}
PositionData.InsertPosition(getApplicationContext(), position);
}
答案 0 :(得分:0)
使用GPS提供商时,轴承通常不会更新/返回,除非设备物理移动并获得速度(检查getSpeed())。在实践中,速度超过1米/秒应该产生精确的轴承。我还发现我不得不偶尔轮询并检查GPS提供商的最后一个已知位置并抓住它的更新轴承以获得正确的读数。