开发者

how to get quick location updates when first time android application loading?

开发者 https://www.devze.com 2023-01-30 12:14 出处:网络
My device always gives me location updates wrongly first time and after some time it shows currectly.I had given time 5000 ms for location updates in LocationListener.

My device always gives me location updates wrongly first time and after some time it shows currectly.I had given time 5000 ms for location updates in LocationListener. But first time my application loads I need quick location update after that need it is ok, in round robin manner.How to make change in my snippet for first time use

locationManager.requestLocationUpdates(bestProvider, 5000, 0, this);

Please give me guidance?

Regards, rajend开发者_如何学运维ar


You shouldn't rely on immediate location values. It can take a long time to acquire satelites etc.

If you would just like a rough estimate, use getLastKnownLocation()


Set your location update to 0 instead of 5000, then set it to 5000 after the first update?

0

精彩评论

暂无评论...
验证码 换一张
取 消