My understanding is getLastKnownLocation is used to give your app an
immediate location since getting a good GPS fix can sometimes take up
to a minute. This way your app would show *something* until a better
position can be determined by initializing a provider, setting up your
time and distance update intervals, and giving that info to
requestLocationUpdates for immediate updates.

Ken

On Dec 2, 2:19 pm, jotobjects <[email protected]> wrote:
> requestLocationUpdates() docs say -
>
> "It may take a while to receive the most recent location. If an
> immediate location is required, applications may use the
> getLastKnownLocation(String) method."
>
> You could verify that getLastKnownLocation(providerName) returns the
> same Location as the argument to onLocationChanged() by logging
> getLatitude(), getLongitude(), and getProvider() for both Location
> values.  If these values are different AND they are different than
> what MyLocation shows then there are three different Location values.
> It would be interesting to know which one is right!
>
> On Dec 2, 1:30 pm, stanlick <[email protected]> wrote:
>
>
>
> > Are you saying if the CB occurred, indicating a new location "fix"
> > that getLastKnownLocation would not also return this last know
> > location?  I think I tried using the the location local variable
> > during one of my permutations and the net effect was the same.  Funny
> > thing is, while the Android API location shows me several blocks from
> > where I am, the My Location button in Google Maps finds me perfectly!
> > I have checked all my criteria and it looks okay.  ACCURACY_FINE no
> > concern for cost, etc.  I just don't get it!  I wish there was a
> > criteria DO_IT_LIKE_GOOGLE_DOES!
>
> > Sleepless in St. Louis,
> > Scott
>
> > On Dec 2, 3:14 pm, Jeffrey Blattman <[email protected]>
> > wrote:
>
> > > LocationManager. requestLocationUpdates()
> > > <http://developer.android.com/reference/android/location/LocationManag...>
> > > LocationListener. onLocationChanged
> > > <http://developer.android.com/reference/android/location/LocationListe...>(Location
> > > <http://developer.android.com/reference/android/location/Location.html>
> > > location)
>
> > > you are passed the location in the CB. no need to call getLastKnown...
>
> > > On 12/2/09 1:10 PM, stanlick wrote:
>
> > > > I *am* using the listener loop and using getLastKnownLocation from the
> > > > locationManager inside the onLocationChanged() method.  Is this not
> > > > the correct pattern?
>
> > > > On Dec 2, 2:31 pm, Lance Nanek<[email protected]>  wrote:
>
> > > >> Why are you using getLastKnownLocation if you want a fresh fix? The
> > > >> documentation says it won't even start the location provider. Use
> > > >> requestLocationUpdates.
>
> > > >> On Dec 2, 2:53 pm, stanlick<[email protected]>  wrote:
>
> > > >>> Didn't we put a man on the moon?  It can't be done seems a little lazy
> > > >>> today!
>
> > > >>> I have read all the posts about this topic and I understand the
> > > >>> arguments being made.  However, I would like to know how Google Maps
> > > >>> can return my *current* location yet while driving the same stretch of
> > > >>> road, the Android API often (not always) gives me a last known
> > > >>> location that was miles back.  I need to be able to rely on the API to
> > > >>> provide me with a *current location* and I have tried all the tricks
> > > >>> being proposed here and elsewhere.  Is there lower level code
> > > >>> someplace that could ping the phone's radio for a "fresh fix?"
>
> > > >>> If you have solved this riddle, I would be happy to pay for your
> > > >>> solution.
>
> > > >>> Peace,
> > > >>> Scott
>
> > > --
>
> > >  qr-gmail.png
> > > < 1KViewDownload

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to