我在跟踪GPS位置与 LocationManager.requestLocationUpdates()
使用 LocationManager.GPS_PROVIDER
和注册 LocationListener的
。
I'm tracking GPS locations with LocationManager.requestLocationUpdates()
using LocationManager.GPS_PROVIDER
and registering a LocationListener
.
我的问题:
所有测试设备(索尼新,索尼活跃,摩托G)产生不具备的第二部分在其的getTime
:位置
对象( )
All tested devices (Sony neo, Sony active, Moto G) produce Location
objects which do not have fractions of a second in their getTime()
:
<trkpt ...><time>2014-05-24T10:24:59.000Z</time></trkpt>
<trkpt ...><time>2014-05-24T10:25:00.000Z</time></trkpt>
<trkpt ...><time>2014-05-24T10:25:01.000Z</time></trkpt>
<trkpt ...><time>2014-05-24T10:25:02.000Z</time></trkpt>
<trkpt ...><time>2014-05-24T10:25:03.000Z</time></trkpt>
正如我在计算速度,坡度和海拔barometic合并,1秒(1000毫秒)的分辨率是太IM precise。我不相信,该修补程序是所有的完全的在 .000
。
我的问题:
时最好是采取 System.currentTimeMillis的()
的时间戳我的跟踪点,或者说是GPS定位一般远远落后于实时和计算位置实际上是那些从过去的(几秒钟后)?
Is is better to take System.currentTimeMillis()
as the timestamp for my track-points, or is the GPS fix generally far behind "real time" and the calculated positions are actually those from the past (several seconds behind)?
注:
在我知道的速度计算不是precise并使用GPS数据时十分复杂 这不是的副本匹配Location.getTime()毫秒到NMEA句子在我的经验中, System.currentTimeMillis的()
是一个更好的方式,采取时间戳,并就是我在做我的应用程序。但是,请注意,由于在Android开发者网站指出, System.currentTimeMillis的()返回当前时间以毫秒为单位自1970年1月1日00:00:00.0 UTC
所以这真的取决于你想用它来做什么。正如我所提到的,虽然,我发现它比其他形式的时间戳更可靠,它可能是最适合你的情况。
In my experience, System.currentTimeMillis()
is a much better way to take timestamps, and it is what I am doing in my app. However, please be advised that, as stated on the android developer site, System.currentTimeMillis() Returns the current time in milliseconds since January 1, 1970 00:00:00.0 UTC
so it really depends on what you want to use it for. As I mentioned though, I found it to be more reliable than other forms of timestamps and it is probably best suited for your case.