To reiterate what's been said, you only want to use getLastKnownLocation()
*ONCE*, at start up, to give you *something* to work with - a starting
point. After that you should be relying only on the location provider
updates for the most accurate location information.
I would suggest you do what
Thanks TreKing --
After pouring through my application last evening, I discovered one of
my tabs was turning *off* the radio in its onPause() method. Once I
remedied that, the app *does* now seem to behave like Google's stuff.
For those who may (pronounced WILL) suffer through this at some
You probably DO want to turn off GPS onPause() though - you don't want your
app to drain the user's battery needlessly getting location updates when
you're not doing anything with it. Just make sure to turn it back on in
onResume() as necessary.
You probably DO want to turn off GPS onPause() though - you don't want
your
app to drain the user's battery needlessly getting location updates when
you're not doing anything with it. Just make sure to turn it back on in
onResume() as necessary.
Considering how long it takes to re-establish
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 stanl...@gmail.com wrote:
Didn't we put a man on the moon? It can't be done seems a little lazy
today!
I
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 lna...@gmail.com wrote:
Why are you using getLastKnownLocation if you want a fresh fix? The
LocationManager. requestLocationUpdates()
http://developer.android.com/reference/android/location/LocationManager.html#requestLocationUpdates%28java.lang.String,%20long,%20float,%20android.app.PendingIntent%29
LocationListener. onLocationChanged
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
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
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
When your app needs to show where *you are* -- where *you were* isn't
going to cut it. It would be like the bank saying we can't tell you
what your balance is now, but we can tell you what it was last
Tuesday. It *must* be possible or the Google Nav and Maps wouldn't
work either. I have it
11 matches
Mail list logo