Why does Android have such problems remembering last know location? 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?
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.