12

I've never been able to figure out the manner in which Android remembers its last know location. If seems to remember the location from several hours ago but not several seconds ago. I think its best to give an example of what I mean.

I was recently in the Bay Area. I was using Google maps on my Android and I happened to be around the Google Campus in Mountain View. I was using maps with GPS enabled and after a while I got a proper GPS lock which I used to navigate around the area.

When I went back to San Francisco later on I was using it to get around the city. Every time I turned on the maps it put my location back in Mountain view. About 10 seconds later after it got the GPS lock I got my real location. If I turned the phone off and on again a few seconds later the same thing happened - it thinks I am in somewhere I was hours earlier and then kicks in with my actual location. This happens all the time - remembering where I was hours ago, not where I was a few moments ago. Once I have been around an area for a certain amount of time this now becomes the new "last know location".

Why, once I get an accurate GPS lock, does Android not register this as the "last known location" instead of one from earlier?

3

Not a complete answer, but some background information:

  • Your device can have more than 1 location provider, e.g. one based on GPS and one based on which mobile phone towers it can see.
  • Android does not have a one single last known position. Each location provider has its own last known position.
  • A location has additional metrics, like accuracy, when it was recorded, what was recorded (e.g. does it have an altitude component etc)

So it depends on which location provider the app uses and that can depend on or even change based on dynamic parameters. E.g. on start-up it could ask Android for the fastest location provider to get going and then switch to the most accurate one to gradually get a better fix.

  • This is a really good, concise explanation. Thank you. – Nick Dixon May 13 '11 at 15:55
  • This also makes sense as when I was back in the city I didn't have wifi/mobile data. At the Google campus there was wifi. So maps must have been initially using the 'coarse' (ie wifi) lastknownlocation (which was in Google) and then when the GPS kicked in a few seconds later it updates. I would have thought still that the GPS lasknownlocation would have been a fresher/better reading. – Tim May 8 '13 at 9:23
  • this answer is more like a comment. and if coarse location have less priority, it would explain even less why the phone returned mnt view later on. – gcb Apr 4 '18 at 12:15
2

It is my understanding that Android uses coarse and fine grained type location updates and these updates can have different quality metrics too. It could be that the Google Maps application didn't have GPS and Wifi signal long enough at your new location to be a high enough quality to be the last know location.

The developer docs at http://developer.android.com/guide/topics/location/obtaining-user-location.html give some example models for obtaining user locations that might give some insight to how it works. But I would guess Google Maps, and probably other maps, do their own thing.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.