Android的LocationClient.getLastLocation()返回旧的,不准确的位置,一个新的时间戳 [英] Android LocationClient.getLastLocation() returns old and inaccurate location with a new timestamp

查看:496
本文介绍了Android的LocationClient.getLastLocation()返回旧的,不准确的位置,一个新的时间戳的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我一直在使用自其发布融合位置提供商和我pretty喜欢它(的方式比老系统更好)。但我在使用组合与地理围栏时LocationClient.lastKnownLocation碰到一个特殊的问题()。设置如下:

I've been using the fused location provider since its release and I am pretty happy with it (way better than the old system). But I ran into a peculiar problem when using geofencing in combination with LocationClient.lastKnownLocation(). The setup is as follows:

我把周围的一些家庭位置的几个地理围栏(随范围)。当我得到一个围栏越过了我的意图检索LocationClient最后已知的位置,并使用它。除了比我还注册与更新模式PRIORITY_BALANCED_POWER_ACCURACY定期位置更新。

I drop several geofences around some home location (with increasing ranges). When I get the intent that a fence is crossed I retrieve the last known location from LocationClient and work with it. Apart from than I also registered for regular location updates with update mode PRIORITY_BALANCED_POWER_ACCURACY.

大多数时候,这工作完全正常,但有时会发生这种情况的:

Most of the times this works perfectly fine, but sometimes this happens:

时间000秒 - (纬度,经度,精确度)=(48.127316,11.5855167,683.0)

Time 000 s - (Lat,Lon,Accuracy) = (48.127316,11.5855167,683.0)

时间120秒 - (纬度,经度,精确度)=(48.1260497,11.5731745,31.823)

Time 120 s - (Lat,Lon,Accuracy) = (48.1260497,11.5731745,31.823)

时间300秒 - (纬度,经度,精确度)=(48.1217455,11.5641666,143.81)

Time 300 s - (Lat,Lon,Accuracy) = (48.1217455,11.5641666,143.81)

时间420秒 - (纬度,经度,精确度)=(48.1189942,11.559061,36.0)

Time 420 s - (Lat,Lon,Accuracy) = (48.1189942,11.559061,36.0)

时间600S - (纬度,经度,精确度)=(48.127316,11.5855167,683.0)

Time 600s - (Lat,Lon,Accuracy) = (48.127316,11.5855167,683.0)

请注意,所有这些位置由<一个检索href=\"http://developer.android.com/reference/com/google/android/gms/location/LocationClient.html#getLastLocation()\"相对=nofollow> getLastKnownLocation()。似乎什么腥这里是与第一和最后一个位置是相同的(即使是在其它属性),更具体

Notice that all these locations are retrieved by getLastKnownLocation(). What seems fishy here is that the first and the last location are identical (even in the other attributes), to be more specific:

* intent at time 0: *

component: ComponentInfo{package.Class}
key [location]: Location[mProvider=fused,mTime=1373524391934,mLatitude=48.127316,mLongitude=11.5855167,mHasAltitude=false,mAltitude=0.0,mHasSpeed=false,mSpeed=0.0,mHasBearing=false,mBearing=0.0,mHasAccuracy=true,mAccuracy=683.0,mExtras=Bundle[mParcelledData.dataSize=352]]

* intent at time 600: *

component: ComponentInfo{package.Class}
key [location]: Location[mProvider=fused,mTime=1373524994871,mLatitude=48.127316,mLongitude=11.5855167,mHasAltitude=false,mAltitude=0.0,mHasSpeed=false,mSpeed=0.0,mHasBearing=false,mBearing=0.0,mHasAccuracy=true,mAccuracy=683.0,mExtras=Bundle[mParcelledData.dataSize=352]]

* note the ~600 s difference in the timestamp * 

我不明白这是如何发生的,因为有过在之间的位置更近,更准确两者。同样在老位置的新时间戳让我好奇...使用旧的API 时发生了明显类似的事情,但这个新位置供应商就被称为融合,所以我不能从的来自传感器的WPS ......如果是手机信号塔的切换问题(在涉及旧的API链接的问题概述)那么为什么将手机连接到一个远塔,如果它已经看到更接近塔?

I do not understand how this can happen, as there have been locations in between that were both more recent and more accurate. Also the new timestamp on an old location makes me curious... apparently similar things happened when using the old API, but this new location provider is just called fused, so I can not distinguish GPS from WPS from sensors... If it is the cell tower switching problem (outlined in the linked question concerning the old API) then why would the phone connect to a "far away" tower if it has seen closer towers?

为什么会出现这种情况?

Why is this happening?

推荐答案

使用电池三角的起点和终点都得到了。误差/精度是典型的基于细胞的位置,它看起来像谷歌省电逻辑决定切换到电池将是美好的,即使你说,它最近的历史包括点非常接近。

The first and last points were gotten using cell triangulation. The error/accuracy is typical of cell-based location, and it looks like the Google power saving logic decided that switching to cell would be OK, even as you say its recent history included points much closer.

这篇关于Android的LocationClient.getLastLocation()返回旧的,不准确的位置,一个新的时间戳的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆