启动定位策略 [英] Start location strategy

查看:203
本文介绍了启动定位策略的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我定期通过GPS接收位置更新,问题是时间,直到第一个位置更新发生 - 它只是长。当用户是在建筑物内,此时会变得沃瑟

I am receiving periodically location updates via GPS, the problem is the time until the first location update occurs - it is just to long. When the user is within a building, this time gets even worser.

所以我在寻找一些策略来提高启动时间(目前我不使用 getLastKnownLocation ,但我会)。我开始阅读深入了解位置得到一些想法和有一些想法,现在我想讨论和你在一起。

Therefore I am looking for some strategies to improve the startup time (at the moment I don't use getLastKnownLocation but I will). I started reading A Deep Dive Into Location to get some ideas and have some thoughts now I would like to discuss with you.

起初,上述博客文章经过该设备并查询每个位置提供了 getLastKnownLocation ,但只考虑他们时,他们都不要老和内允许的精度。

At first the blog post mentioned above goes through each location provider on the device and queries for the getLastKnownLocation, but only considers them when they are not to old and within an allowed accuracy.

下面来我的第一个问题:我希望能有基于网络的位置立即可用,所以我会要求一个新的网络位置,然后我会得到 getLastKnownLocation 从GPS的供应商,如果最后的GPS位置是由基于点的网络位置和半径精度形成,那么我会采取GPS定位,无论是多大的圈子之内。你怎么看?

Here comes my first question: I would expect to have the network based location immediately available, so I would request a new network based location, then I would get getLastKnownLocation from the GPS-provider and if the last GPS-location is within the circle formed by the point network based location and radius accuracy then I would take the GPS location, regardless how old it is. What do you think?

检查最后一个已知位置后我将启动GPS定位跟踪,因为我只需要每2秒以上10μm的改变,我会用 lm.requestLocationUpdates(LocationManager.GPS_PROVIDER,2 * 1000,10,本);

After checking the last known location I will start the GPS position tracking and because I only need it every 2 seconds and 10m change, I would use lm.requestLocationUpdates(LocationManager.GPS_PROVIDER, 2 * 1000, 10, this);

不过,我发现一个规律(在presentation 存在内史诗:最佳实践为Android开发的幻灯片<一href="http://www.slideshare.net/retomeier/being-epic-best-practices-for-building-android-apps/95">95和<一href="http://www.slideshare.net/retomeier/being-epic-best-practices-for-building-android-apps/96">96起初,他打开粗,细的位置(与0,0的时间和距离的变化),然后,当接收到第一个事件的时候,他切换到真正需要的更新频率。所以,做的第一GPS的更新来更快当的时间间隔被设定为0

However I found a pattern (inside the presentation Being Epic: Best Practices for Android Development on slide 95 and 96 that at first he turns on coarse and fine locations (with 0,0 for time and distance changes) and then, when the first event is received, he switches to the really needed update frequency. So, does the first gps-update comes faster when the interval is set to 0?

在对面这个模式我会保持粗略更新,直到接收到第一个GPS更新。你怎么看?

In opposite to this pattern I would keep the coarse update until the first GPS update is received. What do you think?

希望能得到一些有趣的答案!

Hope to get some interesting answers!

----------------更新----------------

----------------Update----------------

我做了一些调查:我打开GPS,等待得到修复。然后我打开GPS关闭,开车50公里(31英里)。然后我用从深入了解地点了code ,以让所有的 getLastKnownLocation 。我试了两次,第一次与GPS关闭,第二,全球定位系统打开,但没有解决:

I did some investigations: I turned on GPS and waited to get a fix. Then I turned GPS off and drove 50km (31 miles). Then I used the code from A Deep Dive Into Location to get all the getLastKnownLocation. I tried it twice, first with GPS turned off and second with GPS turned on, but without a fix:

1)带GPS关掉我
- 提供商:网络,正确的位置精度680米
- 提供:被动(mProvider =网络),如上述同一地点,同一时间如上
- 提供:GPS,位置空

1) with GPS turned off I got
- Provider: network, correct location with accuracy 680m
- Provider: passive (mProvider=network), same location as above, same time as above
- Provider: gps, location null

所以,我了解到,在GPS关闭你没有 getLastKnownLocation

So I learned that when gps is turned off you get no getLastKnownLocation.

2)与GPS开启我
- 提供商:网络,正确的位置精度652米
- 提供:被动(mProvider =网络),如上述同一地点,同一时间如上
- 提供:GPS,位置,因为它为2h早期准确12M,时间也是2小时更早

2) with GPS turned on I got
- Provider: network, correct location with accuracy 652m
- Provider: passive (mProvider=network), same location as above, same time as above
- Provider: gps, location as it was 2h earlier with accuracy 12m, time was also 2h earlier

在这里,我才知道,老消息没有失效,甚至很显然,他们错了。

Here I learned that old messages are not invalidated, even it is obvious that they are wrong.

在这种情况下,算法正常工作,因为我曾在我把GPS关闭的时间。 但是,如果我进入一个房子?在这种情况下,2H旧GPS的结果将是非常不错的,甚至是过时的。

In that case the algorithm works fine, because I moved in the time I turned the GPS off. But what if I enter a house? In that case the 2h old GPS result would be very good, even it is outdated.

推荐答案

在谷歌IO 2013,他们表现出了会议的超越蓝点:在Android的位置新功能一种新的方法,看视频的这里

At the Google IO 2013 they showed in the session Beyond the Blue Dot: New Features in Android Location a new approach, see the video here.

工程师在谷歌尝试了很多不同的策略,结果是融合位置提供。其质量显示在12时17分,在视频

The engineers at Google tried a lot of different strategies, the result is the "Fused location provider". Its quality is shown at 12:17 in the video.

科坦帕尔马出版了一本博客帖子如何稠合位置提供者可以在一个应用实例中使用。

Ketan Parmar has published a blog post how the fused location provider can be used in an example application.

这篇关于启动定位策略的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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