开发者

getLastKnownLocation out-of-date even after other apps find my location!

开发者 https://www.devze.com 2022-12-19 07:32 出处:网络
In my app, I request location updates and use a LocationListener and the majority of the time everything works well.When the app starts, it uses getLastKnownLocation while waiting for the first locati

In my app, I request location updates and use a LocationListener and the majority of the time everything works well. When the app starts, it uses getLastKnownLocation while waiting for the first location update.

I have been doing some tests on getLastKnownLocation and the results are strange...

If the result of getLastKnownLocation is ou开发者_运维百科t-of-date, then I exit the app and run Google Maps and wait for it to pick up my location, then when I re-run my app getLastKnownLocation still returns the old location. I don't understand why this is happening. Surely, if GMaps can get a fix then getLastKnownLocation should be up-to-date, right?

0

精彩评论

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

关注公众号