getLastKnownLocation() Android, when the Last Known Location is updated? -


getbestknownlocation returns location indicating data last known location fix obtained given provider. can done without starting provider. note location out-of-date, example if device turned off , moved location.

when last known location updated in android? updated if when there's application listening location provider, if if there's no application ask location , asked lastknownlocation() ?

please see start location strategy

i did investigations: turned on gps , waited fix. turned gps off , drove 50km (31 miles). used code deep dive location getlastknownlocation. tried twice, first gps turned off , second gps turned on, without fix:

1) gps turned off got - provider: network, correct location accuracy 680m - provider: passive (mprovider=network), same location above, same time above - provider: gps, location null

so learned when gps turned off no getlastknownlocation gps location provider.

2) gps turned on got - provider: network, correct location accuracy 652m - provider: passive (mprovider=network), same location above, same time above - provider: gps, location 2h earlier accuracy 12m, time 2h earlier

here learned old messages not invalidated, obvious wrong.

so sum up: when provider active, stores last received location retreivable via getlastknownlocation. if provider deactivated, don't getlastknownlocation. please note tested gps-provider, other providers may react in different way.


Comments

Popular posts from this blog

c# - how to write client side events functions for the combobox items -

exception - Python, pyPdf OCR error: pyPdf.utils.PdfReadError: EOF marker not found -