Can you check to see if your user has selected Automatic - Use
network-provided values?
The second question would be: Where does the location.getTime() time
come from? Is it provided by the satellite fix itself or from the
phone. If from the phone then it's not really relevant how the user
sets
try usin the time tick event instead of systime... u cud keep track of the
time ticks elapsed...
since u said couple of minutes:
I'm trying to check the age of a GPS fix, so that I can discard
location fixes that are more than, say, a couple of minutes old - I
need my fix to be very accurate.
I just did a test.
location.getTime() 1248184334000
System.currentTimeMillis() 1248184346934
It appears as if the GPS tracks time down to the second and it can
vary from the Automatic setting by quite a bit. This example shows a
variance of about 100 seconds between the two.
Perhaps the best
Hi John
Yes, that's exactly what I have done - I've saved the time of the
first fix, and compare it to the time of the latest fix.
If the two are the same when the time comes to check location, i.e.
there is no time difference, I know that there hasn't been an update
during the life of the
Thanks. Yes, it works much better with requestLocationUpdates set to
0.
For the benefit of anyone reading and reusing code, requesting
location updates drains the battery very quickly, so remember to
unregister the LocationListener whenever you pause the application.
Code below.
Anna
Hi Ludwig,
Thanks for the suggestion. I do implement a listener, when the
application opens. But I found that the GPS data using
getLastKnownLocation was often out of date or inaccurate, and that
caused me real problems, since it's a mapping application and the data
needs to be very accurate - I
The Location object has a getTime() method that should supply you with the
age of the fix. The getLastKnownLocation() call does not miraculously have
another source of location information than what you would get with the
upcall. Set the time in requestLocationUpdates to 0 to get notifications as
I suggest you better implement a location listener, which is much more
light-weight than the busy polling you are implementing. You can cancel your
subscription to location updates once you have one that satisfies you.Ludwig
2009/2/1 Anna PS annapowellsm...@googlemail.com
Great - thank you.
Great - thank you. I'll remember to read the documentation next
time :)
I've pasted my code below in case anyone wants to borrow it: it keeps
polling for up-to-date and accurate GPS data, up to a maximum of 10
seconds. If by then the GPS data is old or not accurate enough, it
just returns false.
Hi,
Subtract the Location.getTime() value from the current time to get the
age of the last fix.
See http://code.google.com/android/reference/android/location/Location.html
Regards
On Jan 23, 10:07 am, Anna PS annapowellsm...@googlemail.com wrote:
Hi
When you get GPS location using
10 matches
Mail list logo