Take the 2-minute tour ×
Android Enthusiasts Stack Exchange is a question and answer site for enthusiasts and power users of the Android operating system. It's 100% free, no registration required.

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?

share|improve this question
    
It's not Android, it's Google Maps. I personally hate the Maps app. –  Matthew Read Feb 10 '11 at 22:03
    
Really? Surely they are just calling the getlastknownlocation(..) method? And if this is the case...what on earth is it doing? –  Tim Feb 11 '11 at 18:20
    
Crazymaking, for sure. –  Amanda Mar 21 '11 at 22:31
    
I just saw the same behavior myself. –  offby1 Dec 2 '11 at 3:46
add comment

2 Answers 2

up vote 3 down vote accepted

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.

share|improve this answer
    
interesting.. thanks for that –  Tim May 13 '11 at 9:51
    
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
add comment

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.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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