本文介绍了为什么Android版的LocationManager有较长时间的延迟之前的位置更新开始,如果设定精度的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如果我设置任何精度标准,它需要很长的时间的LocationManager开始更新位置:

If I set any ACCURACY to criteria, it takes long time to LocationManager to start updating location:

Criteria criteria = new Criteria();
criteria.setAccuracy(Criteria.ACCURACY_FINE);
provider = locationManager.getBestProvider(criteria, true);
locationManager.requestLocationUpdates(provider, 0, 0, this);

如果我删除准确性标志,它会立即启动,但有时并不准确。

If I remove ACCURACY flag, it starts immediately but sometimes not accurate.

怎样才能使它立即开始更新并有很好的准确性?

How can I make it start updating immediately and with good accuracy?

推荐答案

不幸的是,没办法。

如果您使用 ACCURACY_FINE ,你将只使用GPS,但GPS有冷启动的效果。这意味着,如果你的设备不使用GPS很长一段时间,它需要大量的时间与卫星连接和下载历书和星历。您不能更改此行为。

If you use ACCURACY_FINE, you will use GPS only, but GPS have "cold start" effect. It means that if you device not used GPS long time, it needs a lot of time for connecting with satellites and download almanac and ephemeris. You can't change this behavior.

如果你不使用 ACCURACY_FINE ,您将使用GPS和网络(移动的Wi-Fi)信号。所以,你会很快收到第一的位置,从网络,因为他们没有冷启动的效果,但这种方法的准确度较低。当您的GPS模块将准备好了,你会开始从中接收更新了。

If you don't use ACCURACY_FINE, you will use both GPS and network (mobile, wi-fi) signals. So you will receive quick first position from network, because they don't have "cold start" effect, but accuracy of this method is low. When your GPS module will ready, you will start receive updates from it too.

这篇关于为什么Android版的LocationManager有较长时间的延迟之前的位置更新开始,如果设定精度的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

11-03 10:41