Search code examples
javaandroidgoogle-location-services

How recent is getLastLocation?


I'm currently making an Android app for myself, for fun, and wish to get the current location. Maybe I'll publish this on Play Store.

I was reading on the most convenient way to get the current location, but because of the note here, I decided to go the Google way. Eventually, my research got me on a getLastLocation example.

However, what bugs me is how often does this get updated? Is there a way to know how recent this location is? When I call that method, will the device try to update "last location" then return it to me?

I tried to research about it, but the best answer I got is

Returns the best most recent location currently available.


Solution

  • what bugs me is how often does this get updated?

    Possibly never.

    Is there a way to know how recent this location is?

    There is a getTime() method on Location that tells you the system time at which that Location was determined.

    When I call that method, will the device try to update "last location" then return it to me?

    No.